Bonjours,
Je reviens encore avec un problème :
Je veux créer un items qui crée un bloc au dessus du bloc sur lequel on clic, je me suis un peu inspiré des class Itemboat, ItemBed et Itemseed.
Le résultat marche temps que je fais apparaître des blocs vanilla mais quand mes blocs sont ajouté le jeu crash
La class de l’item :
public class GrainesChamps extends Item{
private Block plante = BlocksH.BriqueDeCharbon;
public GrainesChamps()
{
super();
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
{
if (world.isRemote)
{
return true;
}
else if (par7 != 1)
{
return false;
}
else if(world.getBlock(x, y, z) == Blocks.dirt && world.isAirBlock(x, y+1, z))
{
world.setBlock(x, y+1, z, plante);
–par1ItemStack.stackSize;
return true;
}
else
return false;
}
}
la class d’un des blocs que j’ai essayé de mettre (rien de plus simple) :
public class BlocBriqueDeCharbon extends Block{
public BlocBriqueDeCharbon(Material material) {
super(material);
}
}
Le rapport d’erreur :
---- Minecraft Crash Report ----
// Surprise! Haha. Well, this is awkward.
Time: 09/03/14 14:39
Description: Ticking memory connection
java.lang.NullPointerException: Ticking memory connection
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:100)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:685)
at net.minecraft.world.World.setBlock(World.java:549)
at net.minecraft.world.World.setBlock(World.java:697)
at hagrud.Veberisation.Items.GrainesChamps.onItemUse(GrainesChamps.java:34)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:150)
at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:424)
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:596)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:762)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:100)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:685)
at net.minecraft.world.World.setBlock(World.java:549)
at net.minecraft.world.World.setBlock(World.java:697)
at hagrud.Veberisation.Items.GrainesChamps.onItemUse(GrainesChamps.java:34)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:150)
at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:424)
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:596)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242)
-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@68801131
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:762)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787)
-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 8 (amd64) version 6.2
Java Version: 1.7.0_45, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 632548824 bytes (603 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 5763 (322728 bytes; 0 MB) allocated, 5037 (282072 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.01-pre FML v7.2.116.1024 Minecraft Forge 10.12.0.1024 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.116.1024} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.0.1024} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
veberisation{0.0.1} [Veberisation] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 1592 (89152 bytes; 0 MB) allocated, 1115 (62440 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player687'/378, l='New World', x=243,88, y=66,41, z=172,35]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
Le jeu a l’air de crash sur la fonction world.setBlock(x, y+1, z, plante);
note : La class est un essais au final je ne veux pas ajouter des plantes mais des blocs c’est pourquoi je n’utilise pas IPlantable.
Merci pour votre aide.