Résolu CrashReport Nouveau Fluide
-
Bonjour ! J’ai créer un Fluide sur la version 1.7.10 de forge mais j’ai ce crash :
–-- Minecraft Crash Report ---- // You're mean. Time: 20/04/15 10:41 Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.ModMikaVanille.BlockFluidPoison.<init>(BlockFluidPoison.java:22) at fr.squizzcraft.ModMikaVanille.ModBlock.preInit(ModBlock.java:48) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.ModMikaVanille.BlockFluidPoison.<init>(BlockFluidPoison.java:22) at fr.squizzcraft.ModMikaVanille.ModBlock.preInit(ModBlock.java:48) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.7.0_75, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 935990056 bytes (892 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized ModBlock{1.0} [ModBlock] (bin) Unloaded->Constructed->Errored Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics 3000 GL version 3.1.0 - Build 9.17.10.3347, Intel GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1)
D’où provient t-il ?
Mes classes :
package fr.squizzcraft.ModMikaVanille; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import fr.squizzcraft.Proxy.CommonProxy; @Mod(modid = "ModBlock", name = "ModBlock", version = "1.0") public class ModBlock { @Instance("ModBlock") public static ModBlock instance; @SidedProxy(clientSide = "fr.squizzcraft.Proxy.ClientProxy", serverSide = "fr.squizzcraft.Proxy.CommonProxy") public static CommonProxy proxy; public static Block dirtFire; public static Block pickBlock; public static Block hardenedStone; public static Block windowPlanche; public static Fluid fluidPoison; public static Block blockFluidPoison; @EventHandler public void preInit(FMLPreInitializationEvent event) { fluidPoison = new Fluid("fluidpoison"); dirtFire = new DirtFire(Material.rock).setBlockName("dirtFire").setBlockTextureName("ModBlock:dirt_fire").setCreativeTab(CreativeTabs.tabBlock); pickBlock = new PickBlock(Material.rock).setBlockName("pickBlock").setBlockTextureName("ModBlock:pick_block").setCreativeTab(CreativeTabs.tabBlock); hardenedStone = new HardenedStone(Material.rock).setBlockName("hardenedStone").setBlockTextureName("ModBlock:hardened_stone").setCreativeTab(CreativeTabs.tabBlock); windowPlanche = new WindowPlanche(Material.rock).setBlockName("windowPlanche").setBlockTextureName("ModBlock:windowPlanche").setCreativeTab(CreativeTabs.tabBlock); blockFluidPoison = new BlockFluidPoison(fluidPoison, Material.water).setBlockName("blockFluidPoison"); FluidRegistry.registerFluid(fluidPoison); GameRegistry.registerBlock(blockFluidPoison, "ModBlock:" + "_" + blockFluidPoison.getUnlocalizedName().substring(5)); fluidPoison.setUnlocalizedName(blockFluidPoison.getUnlocalizedName()); GameRegistry.registerBlock(dirtFire, "dirtFire"); GameRegistry.registerBlock(pickBlock, "pickBlock"); } @EventHandler public void init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
Et celle du BlockFluide :
package fr.squizzcraft.ModMikaVanille; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockFluidPoison extends BlockFluidClassic { @SideOnly(Side.CLIENT) protected IIcon stillIcon; @SideOnly(Side.CLIENT) protected IIcon flowingIcon; public BlockFluidPoison(Fluid fluid, Material material) { super(fluid, material); setCreativeTab(CreativeTabs.tabMisc); } @Override public IIcon getIcon(int side, int meta) { return (side == 0 || side == 1)? stillIcon : flowingIcon; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) { stillIcon = register.registerIcon("ModBlock:fluidStill"); flowingIcon = register.registerIcon("ModBlock:fluidFlowing"); } @Override public boolean canDisplace(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.canDisplace(world, x, y, z); } @Override public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.displaceIfPossible(world, x, y, z); } @Override public void onEntityCollidedWithBlock(World par1, int par2, int par3, int par4, Entity entity) { if (entity instanceof EntityPlayer) ((EntityPlayer)entity).addPotionEffect(new PotionEffect(Potion.poison.id, 1200, 0)); } } ```</init></init></init></init></init></init>
-
Si je dit pas de bêtise, il faut enregistrer le fluide avant les blocs. Donc met les lignes d’initialisation et d’enregistrement plus haut. Aussi j’ai remarqué que tu met des majuscule dans les noms de tes packages, par convention on en met pas ^^.
-
Oups, je vais tout de suite changer les noms de package ! J’avais oublier ! Et après avoir poser plus haut les enregistrements, j’ai donc réorganiser comme ça :
public static Block dirtFire; public static Block pickBlock; public static Block hardenedStone; public static Block windowPlanche; public static Block blockFluidPoison; @EventHandler public void preInit(FMLPreInitializationEvent event) { fluidPoison = new Fluid("fluidpoison"); blockFluidPoison = new BlockFluidPoison(fluidPoison, Material.water).setBlockName("blockFluidPoison"); dirtFire = new DirtFire(Material.rock).setBlockName("dirtFire").setBlockTextureName("ModBlock:dirt_fire").setCreativeTab(CreativeTabs.tabBlock); pickBlock = new PickBlock(Material.rock).setBlockName("pickBlock").setBlockTextureName("ModBlock:pick_block").setCreativeTab(CreativeTabs.tabBlock); hardenedStone = new HardenedStone(Material.rock).setBlockName("hardenedStone").setBlockTextureName("ModBlock:hardened_stone").setCreativeTab(CreativeTabs.tabBlock); windowPlanche = new WindowPlanche(Material.rock).setBlockName("windowPlanche").setBlockTextureName("ModBlock:windowPlanche").setCreativeTab(CreativeTabs.tabBlock); FluidRegistry.registerFluid(fluidPoison); fluidPoison.setUnlocalizedName(blockFluidPoison.getUnlocalizedName()); GameRegistry.registerBlock(blockFluidPoison, "ModBlock:" + "_" + blockFluidPoison.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(dirtFire, "dirtFire"); GameRegistry.registerBlock(pickBlock, "pickBlock"); }
J’ai toujours un crash :
–-- Minecraft Crash Report ---- // Surprise! Haha. Well, this is awkward. Time: 20/04/15 13:56 Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.modmikavanille.BlockFluidPoison.<init>(BlockFluidPoison.java:27) at fr.squizzcraft.modmikavanille.ModBlock.preInit(ModBlock.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.modmikavanille.BlockFluidPoison.<init>(BlockFluidPoison.java:27) at fr.squizzcraft.modmikavanille.ModBlock.preInit(ModBlock.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.7.0_75, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 932858432 bytes (889 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized ModBlock{1.0} [ModBlock] (bin) Unloaded->Constructed->Errored Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics 3000 GL version 3.1.0 - Build 9.17.10.3347, Intel GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) ```</init></init></init></init></init></init>
-
@‘SquizzCraft’:
Oups, je vais tout de suite changer les noms de package ! J’avais oublier ! Et après avoir poser plus haut les enregistrements, j’ai donc réorganiser comme ça :
public static Block dirtFire; public static Block pickBlock; public static Block hardenedStone; public static Block windowPlanche; public static Block blockFluidPoison; @EventHandler public void preInit(FMLPreInitializationEvent event) { fluidPoison = new Fluid("fluidpoison"); blockFluidPoison = new BlockFluidPoison(fluidPoison, Material.water).setBlockName("blockFluidPoison"); dirtFire = new DirtFire(Material.rock).setBlockName("dirtFire").setBlockTextureName("ModBlock:dirt_fire").setCreativeTab(CreativeTabs.tabBlock); pickBlock = new PickBlock(Material.rock).setBlockName("pickBlock").setBlockTextureName("ModBlock:pick_block").setCreativeTab(CreativeTabs.tabBlock); hardenedStone = new HardenedStone(Material.rock).setBlockName("hardenedStone").setBlockTextureName("ModBlock:hardened_stone").setCreativeTab(CreativeTabs.tabBlock); windowPlanche = new WindowPlanche(Material.rock).setBlockName("windowPlanche").setBlockTextureName("ModBlock:windowPlanche").setCreativeTab(CreativeTabs.tabBlock); FluidRegistry.registerFluid(fluidPoison); fluidPoison.setUnlocalizedName(blockFluidPoison.getUnlocalizedName()); GameRegistry.registerBlock(blockFluidPoison, "ModBlock:" + "_" + blockFluidPoison.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(dirtFire, "dirtFire"); GameRegistry.registerBlock(pickBlock, "pickBlock"); }
J’ai toujours un crash :
–-- Minecraft Crash Report ---- // Surprise! Haha. Well, this is awkward. Time: 20/04/15 13:56 Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.modmikavanille.BlockFluidPoison.<init>(BlockFluidPoison.java:27) at fr.squizzcraft.modmikavanille.ModBlock.preInit(ModBlock.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.modmikavanille.BlockFluidPoison.<init>(BlockFluidPoison.java:27) at fr.squizzcraft.modmikavanille.ModBlock.preInit(ModBlock.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.7.0_75, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 932858432 bytes (889 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized ModBlock{1.0} [ModBlock] (bin) Unloaded->Constructed->Errored Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics 3000 GL version 3.1.0 - Build 9.17.10.3347, Intel GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) ```</init></init></init></init></init></init>
Lorsque tu donnes les sources, donne les en entiers (avec les imports) sinon on peut pas savoir à quelle ligne est le problème.
D’après ce que je vois, il faut utiliser quelques setters quand on utilise les fluides, ce qui n’est pas ton cas, regarde net.minecraft.fluids.FluiDRegistry:32. -
Alors, je redonne mes classes au complet :
package fr.squizzcraft.modmikavanille; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import fr.squizzcraft.Proxy.CommonProxy; @Mod(modid = "ModBlock", name = "ModBlock", version = "1.0") public class ModBlock { @Instance("ModBlock") public static ModBlock instance; @SidedProxy(clientSide = "fr.squizzcraft.Proxy.ClientProxy", serverSide = "fr.squizzcraft.Proxy.CommonProxy") public static CommonProxy proxy; public static Fluid fluidPoison; public static Block dirtFire; public static Block pickBlock; public static Block hardenedStone; public static Block windowPlanche; public static Block blockFluidPoison; @EventHandler public void preInit(FMLPreInitializationEvent event) { fluidPoison = new Fluid("fluidpoison"); blockFluidPoison = new BlockFluidPoison(fluidPoison, Material.water).setBlockName("blockFluidPoison"); dirtFire = new DirtFire(Material.rock).setBlockName("dirtFire").setBlockTextureName("ModBlock:dirt_fire").setCreativeTab(CreativeTabs.tabBlock); pickBlock = new PickBlock(Material.rock).setBlockName("pickBlock").setBlockTextureName("ModBlock:pick_block").setCreativeTab(CreativeTabs.tabBlock); hardenedStone = new HardenedStone(Material.rock).setBlockName("hardenedStone").setBlockTextureName("ModBlock:hardened_stone").setCreativeTab(CreativeTabs.tabBlock); windowPlanche = new WindowPlanche(Material.rock).setBlockName("windowPlanche").setBlockTextureName("ModBlock:windowPlanche").setCreativeTab(CreativeTabs.tabBlock); FluidRegistry.registerFluid(fluidPoison); fluidPoison.setUnlocalizedName(blockFluidPoison.getUnlocalizedName()); GameRegistry.registerBlock(blockFluidPoison, "ModBlock:" + "_" + blockFluidPoison.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(dirtFire, "dirtFire"); GameRegistry.registerBlock(pickBlock, "pickBlock"); } @EventHandler public void init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
package fr.squizzcraft.modmikavanille; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockFluidPoison extends BlockFluidClassic { @SideOnly(Side.CLIENT) protected IIcon stillIcon; @SideOnly(Side.CLIENT) protected IIcon flowingIcon; public BlockFluidPoison(Fluid fluid, Material material) { super(fluid, material); setCreativeTab(CreativeTabs.tabMisc); } @Override public IIcon getIcon(int side, int meta) { return (side == 0 || side == 1)? stillIcon : flowingIcon; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) { stillIcon = register.registerIcon("ModBlock:fluidStill"); flowingIcon = register.registerIcon("ModBlock:fluidFlowing"); } @Override public boolean canDisplace(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.canDisplace(world, x, y, z); } @Override public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.displaceIfPossible(world, x, y, z); } @Override public void onEntityCollidedWithBlock(World par1, int par2, int par3, int par4, Entity entity) { if (entity instanceof EntityPlayer) ((EntityPlayer)entity).addPotionEffect(new PotionEffect(Potion.poison.id, 1200, 0)); } }
Et à la ligne 32, j’ai ça dans la class FluidRegistry :
public static final Fluid WATER = new Fluid("water") { @Override public String getLocalizedName() { return StatCollector.translateToLocal("tile.water.name"); } }.setBlock(Blocks.water).setUnlocalizedName(Blocks.water.getUnlocalizedName());
-
@‘SquizzCraft’:
Alors, je redonne mes classes au complet :
package fr.squizzcraft.modmikavanille; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import fr.squizzcraft.Proxy.CommonProxy; @Mod(modid = "ModBlock", name = "ModBlock", version = "1.0") public class ModBlock { @Instance("ModBlock") public static ModBlock instance; @SidedProxy(clientSide = "fr.squizzcraft.Proxy.ClientProxy", serverSide = "fr.squizzcraft.Proxy.CommonProxy") public static CommonProxy proxy; public static Fluid fluidPoison; public static Block dirtFire; public static Block pickBlock; public static Block hardenedStone; public static Block windowPlanche; public static Block blockFluidPoison; @EventHandler public void preInit(FMLPreInitializationEvent event) { fluidPoison = new Fluid("fluidpoison"); blockFluidPoison = new BlockFluidPoison(fluidPoison, Material.water).setBlockName("blockFluidPoison"); dirtFire = new DirtFire(Material.rock).setBlockName("dirtFire").setBlockTextureName("ModBlock:dirt_fire").setCreativeTab(CreativeTabs.tabBlock); pickBlock = new PickBlock(Material.rock).setBlockName("pickBlock").setBlockTextureName("ModBlock:pick_block").setCreativeTab(CreativeTabs.tabBlock); hardenedStone = new HardenedStone(Material.rock).setBlockName("hardenedStone").setBlockTextureName("ModBlock:hardened_stone").setCreativeTab(CreativeTabs.tabBlock); windowPlanche = new WindowPlanche(Material.rock).setBlockName("windowPlanche").setBlockTextureName("ModBlock:windowPlanche").setCreativeTab(CreativeTabs.tabBlock); FluidRegistry.registerFluid(fluidPoison); fluidPoison.setUnlocalizedName(blockFluidPoison.getUnlocalizedName()); GameRegistry.registerBlock(blockFluidPoison, "ModBlock:" + "_" + blockFluidPoison.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(dirtFire, "dirtFire"); GameRegistry.registerBlock(pickBlock, "pickBlock"); } @EventHandler public void init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
package fr.squizzcraft.modmikavanille; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockFluidPoison extends BlockFluidClassic { @SideOnly(Side.CLIENT) protected IIcon stillIcon; @SideOnly(Side.CLIENT) protected IIcon flowingIcon; public BlockFluidPoison(Fluid fluid, Material material) { super(fluid, material); setCreativeTab(CreativeTabs.tabMisc); } @Override public IIcon getIcon(int side, int meta) { return (side == 0 || side == 1)? stillIcon : flowingIcon; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) { stillIcon = register.registerIcon("ModBlock:fluidStill"); flowingIcon = register.registerIcon("ModBlock:fluidFlowing"); } @Override public boolean canDisplace(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.canDisplace(world, x, y, z); } @Override public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.displaceIfPossible(world, x, y, z); } @Override public void onEntityCollidedWithBlock(World par1, int par2, int par3, int par4, Entity entity) { if (entity instanceof EntityPlayer) ((EntityPlayer)entity).addPotionEffect(new PotionEffect(Potion.poison.id, 1200, 0)); } }
Et à la ligne 32, j’ai ça dans la class FluidRegistry :
public static final Fluid WATER = new Fluid("water") { @Override public String getLocalizedName() { return StatCollector.translateToLocal("tile.water.name"); } }.setBlock(Blocks.water).setUnlocalizedName(Blocks.water.getUnlocalizedName());
Comme tu le vois, dans les classes de minecraft, il y a un setBlock(tonBlock) puis setUnlocalizedName(tonNom) je pense que le problème vient de là : tu n’as mis aucune de ces méthodes, essaie avec, surtout avec le setUnlocalizedName
-
Et bien, l’unlocalizedName c’est pour les Items, c’est le BlockName qui gère ça côté Block !
-
@‘SquizzCraft’:
Et bien, l’unlocalizedName c’est pour les Items, c’est le BlockName qui gère ça côté Block !
Apparemment pour les fluides il faut utiliser le setUnlocalizedName, c’est pas moi qui le dit : c’est dans le code de Minecraft.
-
Effectivement, alors j’ai fais ça :
fluidPoison = new Fluid("fluidpoison").setUnlocalizedName("fluidPoison");
Mais j’ai ce crash Report :
–-- Minecraft Crash Report ---- // Hi. I'm Minecraft, and I'm a crashaholic. Time: 20/04/15 17:58 Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.modmikavanille.BlockFluidPoison.<init>(BlockFluidPoison.java:27) at fr.squizzcraft.modmikavanille.ModBlock.preInit(ModBlock.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.modmikavanille.BlockFluidPoison.<init>(BlockFluidPoison.java:27) at fr.squizzcraft.modmikavanille.ModBlock.preInit(ModBlock.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.7.0_75, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 925733800 bytes (882 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized ModBlock{1.0} [ModBlock] (bin) Unloaded->Constructed->Errored Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics 3000 GL version 3.1.0 - Build 9.17.10.3347, Intel GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) ```</init></init></init></init></init></init>
-
@‘SquizzCraft’:
Effectivement, alors j’ai fais ça :
fluidPoison = new Fluid("fluidpoison").setUnlocalizedName("fluidPoison");
Mais j’ai ce crash Report :
–-- Minecraft Crash Report ---- // Hi. I'm Minecraft, and I'm a crashaholic. Time: 20/04/15 17:58 Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.modmikavanille.BlockFluidPoison.<init>(BlockFluidPoison.java:27) at fr.squizzcraft.modmikavanille.ModBlock.preInit(ModBlock.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraftforge.fluids.FluidRegistry.getFluidID(FluidRegistry.java:119) at net.minecraftforge.fluids.Fluid.getID(Fluid.java:177) at net.minecraftforge.fluids.FluidStack.<init>(FluidStack.java:27) at net.minecraftforge.fluids.BlockFluidClassic.<init>(BlockFluidClassic.java:28) at fr.squizzcraft.modmikavanille.BlockFluidPoison.<init>(BlockFluidPoison.java:27) at fr.squizzcraft.modmikavanille.ModBlock.preInit(ModBlock.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:513) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:239) at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:931) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.7.0_75, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 925733800 bytes (882 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.85.1291 Minecraft Forge 10.13.2.1291 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.10.85.1291} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized Forge{10.13.2.1291} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1291.jar) Unloaded->Constructed->Pre-initialized ModBlock{1.0} [ModBlock] (bin) Unloaded->Constructed->Errored Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics 3000 GL version 3.1.0 - Build 9.17.10.3347, Intel GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) ```</init></init></init></init></init></init>
Fais setBlock(tonBlock) et setUnlocalizedName(tonBlock.getUnlocalizedName()).
-
Alors j’ai fais donc ça :
package fr.squizzcraft.modmikavanille; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import fr.squizzcraft.Proxy.CommonProxy; @Mod(modid = "ModBlock", name = "ModBlock", version = "1.0") public class ModBlock { @Instance("ModBlock") public static ModBlock instance; @SidedProxy(clientSide = "fr.squizzcraft.Proxy.ClientProxy", serverSide = "fr.squizzcraft.Proxy.CommonProxy") public static CommonProxy proxy; public static Fluid fluidPoison; public static Block dirtFire; public static Block pickBlock; public static Block hardenedStone; public static Block windowPlanche; public static Block blockFluidPoison; @EventHandler public void preInit(FMLPreInitializationEvent event) { fluidPoison = new Fluid("fluidpoison").setUnlocalizedName(blockFluidPoison.getUnlocalizedName()); blockFluidPoison = new BlockFluidPoison(fluidPoison, Material.water).setBlockName("blockFluidPoison"); dirtFire = new DirtFire(Material.rock).setBlockName("dirtFire").setBlockTextureName("ModBlock:dirt_fire").setCreativeTab(CreativeTabs.tabBlock); pickBlock = new PickBlock(Material.rock).setBlockName("pickBlock").setBlockTextureName("ModBlock:pick_block").setCreativeTab(CreativeTabs.tabBlock); hardenedStone = new HardenedStone(Material.rock).setBlockName("hardenedStone").setBlockTextureName("ModBlock:hardened_stone").setCreativeTab(CreativeTabs.tabBlock); windowPlanche = new WindowPlanche(Material.rock).setBlockName("windowPlanche").setBlockTextureName("ModBlock:windowPlanche").setCreativeTab(CreativeTabs.tabBlock); FluidRegistry.registerFluid(fluidPoison); fluidPoison.setUnlocalizedName(blockFluidPoison.getUnlocalizedName()); GameRegistry.registerBlock(blockFluidPoison, "ModBlock:" + "_" + blockFluidPoison.getUnlocalizedName().substring(5)); GameRegistry.registerBlock(dirtFire, "dirtFire"); GameRegistry.registerBlock(pickBlock, "pickBlock"); } @EventHandler public void init(FMLInitializationEvent event) { } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
Mais c’est toujours la même !
-
Non, ce n’est pas ça le problème.
Le problème est que le fluide doit être initialisé et enregistré avant que le bloc soit initialiser.
En gros :
1 → fluidPoison = new Fluid ….
2 → FluidRegistry.registerFluid …
3 → blockFluidPoison = new BlockFluidPoison … -
Alors, du coup j’ai rangé ça comme ça :
@EventHandler public void preInit(FMLPreInitializationEvent event) { fluidPoison = new Fluid("fluidpoison").setUnlocalizedName(blockFluidPoison.getUnlocalizedName()); FluidRegistry.registerFluid(fluidPoison); blockFluidPoison = new BlockFluidPoison(fluidPoison, Material.water).setBlockName("blockFluidPoison");
Mais j’ai toujours le crash
-
Enlève a ligne .setUnlocalizedName(blockFluidPoison.getUnlocalizedName());
Si ça crash encore renvoie le rapport. -
C’est parfait ! Merci !