[1.12] Créer un four
-
@BrokenSwing Oui en effet merci mais mtn rien ne se passe…
Voici les classe que j’ai utilisé :Classe du block :
https://pastebin.com/mVtbYtZYClasse du TileEntity:
https://pastebin.com/DDzBTqLUClasse du Container :
https://pastebin.com/ECKrR7kzClasse du GUI:
https://pastebin.com/fF17qQFsIl y a également la classe GuiHandler et Recipes donc si besoin je peux les mettre également
-
Bonjour alors j’ai suivi ce tuto (qui était extrêmement bien expliqué en passant) et j’ai un problème c’est que déjà das mes classes je n’ai aucune fonction instance qui est utilisée dans deux classe ! J’ai également une erreur au niveau de ma classe tileentity il me demande d’ajouter des methode est ce que je dois le faire (et les modifier peut etre). Il y en a également une dans ma classe principale mais elle est toujours du a la fonction instance^^. Merci
-
Bonjour,
Pour l’instance, voir le tutoriel sur la base du mod: https://www.minecraftforgefrance.fr/topic/2906/créer-la-base-de-son-mod
Pour les méthodes non implémenté dans la classe TileMachineBuilder, cliques suradd unimplemented methods
et regardes à la fin, il faudra ajouter le contenu appropriée dans les méthodes ajoutées. -
@robin4002 Alors premierement merci et ensuite il me reste cette erreur. Il que je retire @override, et aussi la methode qu’il m’a generer je ne vois pas comment la completer ^^
-
-
@robin4002 j’ai une erreur lors du lancement de minecraft aussi comme quoi mon objet n’as pas de nom alors que ce n’est pas le cas
[19:50:08] [main/INFO] [GradleStart]: Extra: [] [19:50:08] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Benoit/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [19:50:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [19:50:08] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [19:50:08] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [19:50:08] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [19:50:08] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2768 for Minecraft 1.12.2 loading [19:50:08] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_241, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jdk1.8.0_241\jre [19:50:08] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory. [19:50:08] [main/ERROR] [FML]: Full: C:\Users\Benoit\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar [19:50:08] [main/ERROR] [FML]: Trimmed: c:/users/benoit/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/ [19:50:08] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [19:50:08] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs. 2020-04-26 19:50:11,357 main WARN Disabling terminal, you're running in an unsupported environment. [19:50:11] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin [19:50:11] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin [19:50:11] [main/INFO] [FML]: Searching C:\Users\Benoit\Desktop\forge-1.12.2-14.23.5.2768-mdk\.\mods for mods [19:50:11] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [19:50:11] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [19:50:11] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [19:50:11] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [19:50:11] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [19:50:11] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [19:50:11] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [19:50:11] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [19:50:11] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [19:50:16] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [19:50:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [19:50:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [19:50:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [19:50:16] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [19:50:16] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [19:50:16] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [19:50:18] [main/INFO] [minecraft/Minecraft]: Setting user: Player419 [19:50:27] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer: [19:50:27] [main/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4 [19:50:29] [main/INFO] [FML]: -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_241, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 909351992 bytes (867 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '4.5.0 - Build 25.20.100.6444' Renderer: 'Intel(R) UHD Graphics 600' [19:50:29] [main/INFO] [FML]: MinecraftForge v14.23.5.2768 Initialized [19:50:29] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients. [19:50:30] [main/INFO] [FML]: Replaced 1036 ore ingredients [19:50:31] [main/INFO] [FML]: Searching C:\Users\Benoit\Desktop\forge-1.12.2-14.23.5.2768-mdk\.\mods for mods [19:50:37] [main/INFO] [FML]: Forge Mod Loader has identified 5 mods to load [19:50:37] [Thread-3/INFO] [FML]: Using sync timing. 200 frames of Display.update took 813235700 nanos [19:50:37] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, heaven] at CLIENT [19:50:37] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, heaven] at SERVER [19:50:39] [main/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Heaven Mod [19:50:39] [main/INFO] [FML]: Processing ObjectHolder annotations [19:50:40] [main/INFO] [FML]: Found 1168 ObjectHolder annotations [19:50:40] [main/INFO] [FML]: Identifying ItemStackHolder annotations [19:50:40] [main/INFO] [FML]: Found 0 ItemStackHolder annotations [19:50:40] [main/INFO] [FML]: Configured a dormant chunk cache size of 0 [19:50:40] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [19:50:40] [main/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.RegistryEvent$Register@44e69674: java.lang.NullPointerException: Can't use a null-name for the registry, object null. at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864) ~[guava-21.0.jar:?] at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:295) ~[ForgeRegistry.class:?] at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:289) ~[ForgeRegistry.class:?] at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:122) ~[ForgeRegistry.class:?] at net.minecraftforge.registries.ForgeRegistry.registerAll(ForgeRegistry.java:163) ~[ForgeRegistry.class:?] at com.ben.heaven.init.MachineBlock.registerBlocks(MachineBlock.java:32) ~[MachineBlock.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_20_MachineBlock_registerBlocks_Register.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144) ~[EventBus$1.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?] at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:777) [GameData.class:?] at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:513) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_241] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_241] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_241] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_241] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] [19:50:40] [main/ERROR] [FML]: Index: 11 Listeners: [19:50:40] [main/ERROR] [FML]: 0: NORMAL [19:50:40] [main/ERROR] [FML]: 1: net.minecraftforge.fml.common.eventhandler.EventBus$1@7768ffae [19:50:40] [main/ERROR] [FML]: 2: net.minecraftforge.fml.common.eventhandler.EventBus$1@23195ebe [19:50:40] [main/ERROR] [FML]: 3: net.minecraftforge.fml.common.eventhandler.EventBus$1@5c866852 [19:50:40] [main/ERROR] [FML]: 4: net.minecraftforge.fml.common.eventhandler.EventBus$1@4481a37f [19:50:40] [main/ERROR] [FML]: 5: net.minecraftforge.fml.common.eventhandler.EventBus$1@7424b1ce [19:50:40] [main/ERROR] [FML]: 6: net.minecraftforge.fml.common.eventhandler.EventBus$1@1d21fd5a [19:50:40] [main/ERROR] [FML]: 7: net.minecraftforge.fml.common.eventhandler.EventBus$1@728ad254 [19:50:40] [main/ERROR] [FML]: 8: net.minecraftforge.fml.common.eventhandler.EventBus$1@3b590d21 [19:50:40] [main/ERROR] [FML]: 9: net.minecraftforge.fml.common.eventhandler.EventBus$1@6aa27145 [19:50:40] [main/ERROR] [FML]: 10: net.minecraftforge.fml.common.eventhandler.EventBus$1@78fb8a66 [19:50:40] [main/ERROR] [FML]: 11: net.minecraftforge.fml.common.eventhandler.EventBus$1@5c47ef5f [19:50:40] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null [19:50:40] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: ---- Minecraft Crash Report ---- // Why did you do that? Time: 4/26/20 7:50 PM Description: Initializing game java.lang.NullPointerException: Can't use a null-name for the registry, object null. at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864) at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:295) at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:289) at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:122) at net.minecraftforge.registries.ForgeRegistry.registerAll(ForgeRegistry.java:163) at com.ben.heaven.init.MachineBlock.registerBlocks(MachineBlock.java:32) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_20_MachineBlock_registerBlocks_Register.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:777) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252) at net.minecraft.client.Minecraft.init(Minecraft.java:513) at net.minecraft.client.Minecraft.run(Minecraft.java:421) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864) at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:295) at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:289) at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:122) at net.minecraftforge.registries.ForgeRegistry.registerAll(ForgeRegistry.java:163) at com.ben.heaven.init.MachineBlock.registerBlocks(MachineBlock.java:32) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_20_MachineBlock_registerBlocks_Register.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:144) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:777) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:628) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:252) at net.minecraft.client.Minecraft.init(Minecraft.java:513) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:421) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_241, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 904502424 bytes (862 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.42 Powered by Forge 14.23.5.2768 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:----- |:--------- |:------------ |:-------------------------------- |:--------- | | UCH | minecraft | 1.12.2 | minecraft.jar | None | | UCH | mcp | 9.42 | minecraft.jar | None | | UCH | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.5.2768.jar | None | | UCH | forge | 14.23.5.2768 | forgeSrc-1.12.2-14.23.5.2768.jar | None | | UCH | heaven | 1.0.0 | bin | None | Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '4.5.0 - Build 25.20.100.6444' Renderer: 'Intel(R) UHD Graphics 600' Launched Version: 1.12.2 LWJGL: 2.9.4 OpenGL: Intel(R) UHD Graphics 600 GL version 4.5.0 - Build 25.20.100.6444, Intel GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: Yes 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) CPU: 2x Intel(R) Celeron(R) N4000 CPU @ 1.10GHz [19:50:40] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Benoit\Desktop\forge-1.12.2-14.23.5.2768-mdk\.\crash-reports\crash-2020-04-26_19.50.40-client.txt Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
-
Ok en fait la fonction update est nommé tick chez toi (probablement car tu n’as pas la même version des mappings que dans le tutoriel).
Donc renomme simplement la fonction update en tick et retire la fonction généré en dessous.Ensuite pour le crash, c’est parce que tu enregistres un bloc qui est null.
Tu peux envoyer le code de la classe MachineBlock ? -
package com.ben.heaven.blocks; import com.ben.heaven.Heaven; import com.ben.heaven.tileentity.TileMachineBuilder; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class MachineBuilder extends BlockContainer { public MachineBuilder(String name, Material materialIn) { super(materialIn); setUnlocalizedName(name); setRegistryName(name); } @Override public boolean hasTileEntity() { return true; } @Override public TileEntity createNewTileEntity(World world, int metadata) { return new TileMachineBuilder(); } @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileMachineBuilder) { InventoryHelper.dropInventoryItems(worldIn, pos, (TileMachineBuilder) tileentity); } super.breakBlock(worldIn, pos, state); } @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; } else { TileEntity tileentity = world.getTileEntity(pos); if (tileentity instanceof TileMachineBuilder) { player.openGui(Heaven.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); } return true; } } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileMachineBuilder) { ((TileMachineBuilder) tileentity).setCustomName(stack .getDisplayName()); } } } }
-
at com.ben.heaven.init.MachineBlock.registerBlocks(MachineBlock.java:32)
C’est MachineBlock qu’il me faut, pas MachineBuilder.
-
@robin4002 en fait c’est bon l’erreur etait du a la mauvaise nomination de la fonction merci beaucoup^^
-
@robin4002 par contre g verifie la classe recipe je ne vois pas ce qui ne va pas mais la machine ne transforme pas les pommes et fleche en patate cuite (j’ai repris l’exemple du tuto pour test) voici egalement ma classe recipe
package com.ben.heaven.recipes; import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class RecipesMachineBuilder { private static final HashMap <ItemStack[], ItemStack>recipes = new HashMap<ItemStack[], ItemStack>(); static { addRecipe(Items.APPLE, Items.ARROW, Items.BAKED_POTATO); } private static void addRecipe(Item ingredient1, Item ingredient2, Item resultat1) { addRecipe(new ItemStack(ingredient1), new ItemStack(ingredient2), new ItemStack(resultat1)); } private static void addRecipe(ItemStack ingredient1, ItemStack ingredient2, ItemStack resultat1) { recipes.put(new ItemStack[]{ingredient1, ingredient2}, resultat1); } private static boolean areKeysEqual(ItemStack[] key1, ItemStack[] key2) { if(key1.length != key2.length) return false; for(int i = 0; i < key1.length; i++) { ItemStack s1 = key1[i]; ItemStack s2 = key2[i]; if(s1.isEmpty() && !s2.isEmpty()) return false; if(!s1.isEmpty() && s2.isEmpty()) return false; if(s1.getItem() != s2.getItem()) return false; if(s1.getItemDamage() != s2.getItemDamage()) return false; } return true; } public static ItemStack getRecipeResult(ItemStack[] ingredients) { Iterator<Entry<ItemStack[], ItemStack>> it = recipes.entrySet().iterator(); while(it.hasNext()) { Entry <ItemStack[], ItemStack>entry = it.next(); if(areKeysEqual(entry.getKey(), ingredients)) { return entry.getValue(); } } return null; } }
-
@robin4002 saurais tu pourquoi la recette ne fonctionne pas ?
-
Non, sinon j’aurai déjà répondu.
-
@robin4002 d’accord excuse moi ^^
-
Il faut que tu debug ton code de ton côté.
Lances le jeu en mode debug (icône de scarabée) puis mets des points d’arrêt aux endroits pertinent dans le code (par exemple dans la fonction tick, c’est ici qu’il vérifie s’il y a quelque chose à faire).
Quand l’exécution arrive sur un point d’arrêt cela mets en pause le jeu et tu peux observer le contenu des variables.
-
@robin4002 D’accord pour le debug pas de probleme mais les points d’arret et la suite je comprends ce qu’il faut faire mais je ne comprends pas comment ^^
-
Premier lien après recherche google : https://pierrejean.wp.imt.fr/2014/02/17/eclipse-debogage-et-points-darrets/
Un jour je ferai une vidéo sur l’utilisation du debogguer.
-
Dans la classe du Gui tu peux supprimer la ligne
drawDefaultBackground()
et ajouter a la place dans la classe ceci:public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); super.drawScreen(mouseX, mouseY, partialTicks); this.renderHoveredToolTip(mouseX, mouseY); }
comme ca en plus sa rend les tooltips des items quand tu passes dessus