Problème de Craft



  • Bonsoir, j'essaye d'insérer un colorant (dye) dans un de mes craft mais ma ligne de code fait crash mon jeu au lancement.

    Ma ligne :

    GameRegistry.addRecipe(new ItemStack(BlockMod.black_bricks, 1), new Object[]{"#","F", '#', Item.itemRegistry.getObject("dye:0"), 'F',Blocks.brick_block});
    

    Mon log du crash:

    ---- Minecraft Crash Report ----
    // Shall we play a game?
    
    Time: 20/06/19 02:06
    Description: Initializing game
    
    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Character
    	at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:209)
    	at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250)
    	at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:245)
    	at com.mod.adium.init.BlockMod.register(BlockMod.java:49)
    	at com.mod.adium.Adium.preInit(Adium.java:52)
    	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:532)
    	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:212)
    	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
    	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:119)
    	at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)
    	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
    	at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
    	at net.minecraft.client.Minecraft.run(Minecraft.java:942)
    	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.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:209)
    	at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250)
    	at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:245)
    	at com.mod.adium.init.BlockMod.register(BlockMod.java:49)
    	at com.mod.adium.Adium.preInit(Adium.java:52)
    	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:532)
    	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:212)
    	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
    	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:119)
    	at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)
    	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
    	at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
    
    -- Initialization --
    Details:
    Stacktrace:
    	at net.minecraft.client.Minecraft.run(Minecraft.java:942)
    	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.8.0_211, Oracle Corporation
    	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    	Memory: 823329728 bytes (785 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.99.99 Minecraft Forge 10.13.4.1614 4 mods loaded, 4 mods active
    	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    	UCH	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    	UCH	FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) 
    	UCH	Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) 
    	UCE	adium{1.1.8} [Adium Mod] (bin) 
    	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 391.35' Renderer: 'GeForce GT 620/PCIe/SSE2'
    	Launched Version: 1.7.10
    	LWJGL: 2.9.1
    	OpenGL: GeForce GT 620/PCIe/SSE2 GL version 4.6.0 NVIDIA 391.35, NVIDIA Corporation
    	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 (UK)
    	Profiler Position: N/A (disabled)
    	Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    	Anisotropic Filtering: Off (1)
    

    Merci de votre aide.



  • essaies plutôt ça

         GameRegistry.addRecipe(new ItemStack(BlockMod.black_bricks, 1), new Object[]{" # ", " F ", "   ",  '#', Items.dye, 'F',Blocks.brick_block});


  • @lezinkdu07 a dit dans Problème de Craft :

    cks, 1), new Object[]{" # ", " F ", " ", '#', Items.dye, 'F',Blocks.brick_block});

    Salut, ce code fonctionne mais pas complètement, je m'explique :

    Quand je met juste le bloc de brick il me donne le black_brick
    https://imgur.com/sfC3lvV

    Quand je met le colorant avec il me met rien
    https://imgur.com/1v3PEH7

    ma ligne de code (modif)

    GameRegistry.addRecipe(new ItemStack(BlockMod.black_bricks, 1), new Object[] {" # ", " F ", " ", '#',Blocks.brick_block, 'F', Items.dye});
    


  • UPDATE:
    J'ai trouvé une solution :
    https://imgur.com/Ba0SlKY

    Merci pour ton aide 😉



  • Selon t'as version tu à le format json qui fonctionne très bien.



  • C'est à dire ?



  • ça veut dire qu'à partir de la 1.12 (il me semble) les craft sont gérés par les fichier .json, mais cela te concerne pas car tu es en 1.7.10


Log in to reply