Update 1.11
-
Je suis en train d’update mon mod pour pouvoir bénificier des nouvelles choses.
Mais je n’arrive pas a trouvez une solution pour le register des mobs.Avant en 1.9.4 c’était cela
EntityRegistry.registerModEntity(MobTuto.class, "mobTutoriel", 30, this.instance, 80, 1, true); EntityRegistry.registerEgg(MobTuto.class, 99, 12); EntityRegistry.registerModEntity(Tituya.class, "tituya", 40, this.instance, 80, 1, true); EntityRegistry.registerEgg(Tituya.class, 255, 182); EntityRegistry.registerModEntity(gardien.class, "gardien", 50, this.instance, 80, 1, true); EntityRegistry.registerEgg(gardien.class, 200, 470);
Mais en 1.11, cela a changé ! comment faire ?
-
Salut,
Tu as une erreur sur les fonctions ?
Car au dernière nouvelle ce code est encore bon. Il est sinon aussi possible d’entrer avec l’event RegistryEvent.Register -
D’où peu venir le problème ?
Voila le probleme
The method registerModEntity(ResourceLocation, Class, String, int, Object, int, int, boolean) in the type EntityRegistry is not applicable for the arguments (Class<gardien>, String, int, ModTuto, int, int, boolean)
Et j’ai aussi autre chose, il me dit que j’ai besoin d’un JRE je cite "There are no JREs installed in the workspace that are strictly compatible with this environment. MDKExample Build path JRE System Library Problem
Le probleme peu venir d’ici ?
Mais ce qui est étrange c’est que sur mon autre projet (encore en 1.9.4) Il n’y a pas ce message d’erreur. Etrange :-/</gardien> -
Ah, faut mettre une ressource en plus maintenant :
EntityRegistry.registerModEntity(new ResourceLocation(“modid:mobTutoriel”), MobTuto.class, “mobTutoriel”, 30, this.instance, 80, 1, true);Pour java, réinstalles-le.
-
Cela ne fonctionne pas non plus
The method registerModEntity(ResourceLocation, Class, String, int, Object, int, int, boolean) in the type EntityRegistry is not applicable for the arguments (String, Class<mobtuto>, String, int, ModTuto, int, int, boolean)
Je précise, j’ai fait cela
EntityRegistry.registerModEntity("modid:mobTutoriel", MobTuto.class, "mobTutoriel", 30, this.instance, 80, 1, true); EntityRegistry.registerEgg("modid:mobTutoriel", MobTuto.class, 99, 12);
[Edit]
Trouvé !
Merci quand meme, il faut faire maintenant :EntityRegistry.registerModEntity(new ResourceLocation("tuto", "mobTutoriel"), MobTuto.class, "mobTutoriel", 30, this.instance, 80, 1, true, new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB()); ```</mobtuto>
-
Heu oui j’ai oublié de mettre new ResourceLocation x)
-
Hop nouveau probleme
Crash pendant le lancement du jeu. Selon le crash report, c’est a cause de mes blocks
Crash2017-06-01 18:22:35,808 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-06-01 18:22:35,811 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [18:22:35] [main/INFO] [GradleStart]: Extra: [] [18:22:36] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/laura pc/.gradle/caches/minecraft/assets, --assetIndex, 1.11, --accessToken{REDACTED}, --version, 1.11.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [18:22:36] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [18:22:36] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [18:22:36] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [18:22:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [18:22:36] [main/INFO] [FML]: Forge Mod Loader version 13.20.0.2310 for Minecraft 1.11.2 loading [18:22:36] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_111, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jre1.8.0_111 [18:22:36] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [18:22:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [18:22:36] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [18:22:36] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [18:22:36] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:22:36] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [18:22:36] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [18:22:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:22:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:22:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [18:22:36] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [18:22:39] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [18:22:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [18:22:39] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [18:22:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [18:22:40] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [18:22:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [18:22:40] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} 2017-06-01 18:22:41,808 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-06-01 18:22:41,864 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream 2017-06-01 18:22:41,867 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream [18:22:42] [Client thread/INFO]: Setting user: Player387 [18:22:49] [Client thread/INFO]: LWJGL Version: 2.9.4 [18:22:51] [Client thread/INFO] [FML]: – System Details -- Details: Minecraft Version: 1.11.2 Operating System: Windows 7 (x86) version 6.1 Java Version: 1.8.0_111, Oracle Corporation Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation Memory: 774654352 bytes (738 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 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: 'ATI Technologies Inc.' Version: '4.1.10664 Compatibility Profile Context' Renderer: 'ATI Mobility Radeon HD 5470' [18:22:51] [Client thread/INFO] [FML]: MinecraftForge v13.20.0.2310 Initialized [18:22:51] [Client thread/INFO] [FML]: Replaced 232 ore recipes [18:22:52] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer [18:22:52] [Client thread/INFO] [FML]: Searching C:\Users\laura pc\Desktop\Benji\ModderMinecraft\forge-1.11-2\run\mods for mods [18:22:53] [Thread-6/INFO] [FML]: Using sync timing. 200 frames of Display.update took 122610818 nanos [18:22:55] [Client thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to load [18:22:56] [Client thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, tuto] at CLIENT [18:22:56] [Client thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, tuto] at SERVER [18:22:59] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:mod tuto [18:22:59] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [18:22:59] [Client thread/INFO] [FML]: Found 445 ObjectHolder annotations [18:22:59] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations [18:22:59] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations [18:22:59] [Client thread/INFO] [FML]: Applying holder lookups [18:22:59] [Client thread/INFO] [FML]: Holder lookups applied [18:22:59] [Client thread/INFO] [FML]: Applying holder lookups [18:22:59] [Client thread/INFO] [FML]: Holder lookups applied [18:22:59] [Client thread/INFO] [FML]: Applying holder lookups [18:22:59] [Client thread/INFO] [FML]: Holder lookups applied [18:23:00] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [18:23:00] [Forge Version Check/INFO] [ForgeVersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json [18:23:00] [Client thread/ERROR] [FML]: Attempt to register object without having set a registry name Block{null} (type com.tuto.mod.blocks.BlockMod) [18:23:00] [Client thread/INFO] [FML]: Applying holder lookups [18:23:00] [Client thread/INFO] [FML]: Holder lookups applied [18:23:00] [Client thread/INFO] [FML]: Injecting itemstacks [18:23:00] [Client thread/INFO] [FML]: Itemstack injection complete [18:23:00] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue [18:23:00] [Client thread/ERROR] [FML]: States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCH minecraft{1.11.2} [Minecraft] (minecraft.jar) UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.11.2-13.20.0.2310.jar) UCH forge{13.20.0.2310} [Minecraft Forge] (forgeSrc-1.11.2-13.20.0.2310.jar) UCE tuto{1.3.0} [mod tuto] (bin) [18:23:00] [Client thread/ERROR] [FML]: The following problems were captured during this phase [18:23:00] [Client thread/ERROR] [FML]: Caught exception from mod tuto (tuto) java.lang.IllegalArgumentException: No registry name set for object Block{null} (com.tuto.mod.blocks.BlockMod) at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:222) ~[forgeSrc-1.11.2-13.20.0.2310.jar:?] at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:205) ~[forgeSrc-1.11.2-13.20.0.2310.jar:?] at com.tuto.mod.init.BlocksMod.registerBlock(BlocksMod.java:58) ~[bin/:?] at com.tuto.mod.ModTuto.preInit(ModTuto.java:65) ~[bin/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111] at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:643) ~[forgeSrc-1.11.2-13.20.0.2310.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:252) ~[forgeSrc-1.11.2-13.20.0.2310.jar:?] at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:230) ~[forgeSrc-1.11.2-13.20.0.2310.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111] at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?] at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?] at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:147) [LoadController.class:?] at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:647) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:276) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.init(Minecraft.java:478) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111] 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_111] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] [18:23:00] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: –-- Minecraft Crash Report ---- // You're mean. Time: 6/1/17 6:23 PM Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from mod tuto (tuto) Caused by: java.lang.IllegalArgumentException: No registry name set for object Block{null} (com.tuto.mod.blocks.BlockMod) at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:222) at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:205) at com.tuto.mod.init.BlocksMod.registerBlock(BlocksMod.java:58) at com.tuto.mod.ModTuto.preInit(ModTuto.java:65) 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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:643) 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 net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:252) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:230) 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 net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:147) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:647) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:276) at net.minecraft.client.Minecraft.init(Minecraft.java:478) at net.minecraft.client.Minecraft.run(Minecraft.java:387) at net.minecraft.client.main.Main.main(Main.java:118) 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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.11.2 Operating System: Windows 7 (x86) version 6.1 Java Version: 1.8.0_111, Oracle Corporation Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation Memory: 910026944 bytes (867 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.38 Powered by Forge 13.20.0.2310 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 UCH minecraft{1.11.2} [Minecraft] (minecraft.jar) UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.11.2-13.20.0.2310.jar) UCH forge{13.20.0.2310} [Minecraft Forge] (forgeSrc-1.11.2-13.20.0.2310.jar) UCE tuto{1.3.0} [mod tuto] (bin) Loaded coremods (and transformers): GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.1.10664 Compatibility Profile Context' Renderer: 'ATI Mobility Radeon HD 5470' [18:23:00] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\laura pc\Desktop\Benji\ModderMinecraft\forge-1.11-2\run\.\crash-reports\crash-2017-06-01_18.23.00-client.txt Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
Ma classe Blocks
package com.tuto.mod.init; import com.tuto.mod.ModTuto; import com.tuto.mod.References; import com.tuto.mod.blocks.BlockMod; import com.tuto.mod.blocks.GrassMod; import com.tuto.mod.blocks.MachineMod; import com.tuto.mod.blocks.MachineoMod; import com.tuto.mod.blocks.MachineosupMod; import com.tuto.mod.blocks.MachinesupMod; import com.tuto.mod.blocks.RubiksMod; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class BlocksMod { public static Block blockTest; public static Block blockT; public static Block dustBlock; public static Block supBlock; public static Block grassT; public static Block rubiks; public static Block reBlock; public static Block machine; public static Block machineo; public static Block machinesup; public static Block machineosup; public static void init() { blockTest = new BlockMod(Material.ROCK).setUnlocalizedName("blockTest").setCreativeTab(ModTuto.tabTuto); blockT = new BlockMod(Material.ROCK).setUnlocalizedName("blockT").setCreativeTab(ModTuto.tabTuto); dustBlock = new BlockMod(Material.ROCK).setUnlocalizedName("dustBlock").setCreativeTab(ModTuto.tabTuto); supBlock = new BlockMod(Material.ROCK).setUnlocalizedName("supBlock").setCreativeTab(ModTuto.tabTuto); grassT = new GrassMod(Material.GRASS).setUnlocalizedName("grassT").setCreativeTab(ModTuto.tabTuto); rubiks = new RubiksMod(Material.ROCK).setUnlocalizedName("rubiks").setCreativeTab(ModTuto.tabTuto); reBlock= new BlockMod(Material.ROCK).setUnlocalizedName("reBlock").setCreativeTab(ModTuto.tabTuto); machine= new MachineMod(Material.ROCK).setUnlocalizedName("machine").setCreativeTab(ModTuto.tabTuto); machineo= new MachineoMod(Material.ROCK).setUnlocalizedName("machineo").setCreativeTab(ModTuto.tabTuto); machinesup= new MachinesupMod(Material.ROCK).setUnlocalizedName("machinesup").setCreativeTab(ModTuto.tabTuto); machineosup= new MachineosupMod(Material.ROCK).setUnlocalizedName("machineosup").setCreativeTab(ModTuto.tabTuto); } public static void registerBlock() { GameRegistry.register (blockTest); GameRegistry.register(blockT); GameRegistry.register(dustBlock); GameRegistry.register(supBlock); GameRegistry.register(grassT); GameRegistry.register(rubiks); GameRegistry.register(reBlock); GameRegistry.register(machine); GameRegistry.register(machineo); GameRegistry.register(machinesup); GameRegistry.register(machineosup); } public static void registerItemBlocks () { registerItemBlock (blockTest); registerItemBlock (blockT); registerItemBlock (dustBlock); registerItemBlock (supBlock); registerItemBlock (grassT); registerItemBlock (rubiks); registerItemBlock (reBlock); registerItemBlock (machine); registerItemBlock (machineo); registerItemBlock (machinesup); registerItemBlock (machineosup); } @SideOnly (Side.CLIENT) public static void registerItemBlockModels () { ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (blockTest), 0, new ModelResourceLocation (References.MOD_ID+":blockTest", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (blockT), 0, new ModelResourceLocation (References.MOD_ID+":blockT", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (dustBlock), 0, new ModelResourceLocation (References.MOD_ID+":dustBlock", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (supBlock), 0, new ModelResourceLocation (References.MOD_ID+":supBlock", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (grassT), 0, new ModelResourceLocation (References.MOD_ID+":grassT", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (rubiks), 0, new ModelResourceLocation (References.MOD_ID+":rubiks", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (reBlock), 0, new ModelResourceLocation (References.MOD_ID+":reBlock", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (machine), 0, new ModelResourceLocation (References.MOD_ID+":machine", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (machineo), 0, new ModelResourceLocation (References.MOD_ID+":machineo", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (machinesup), 0, new ModelResourceLocation (References.MOD_ID+":machinesup", "inventory")); ModelLoader.setCustomModelResourceLocation (Item.getItemFromBlock (machineosup), 0, new ModelResourceLocation (References.MOD_ID+":machineosup", "inventory")); } private static void registerItemBlock (Block block) { ItemBlock itemBlock = new ItemBlock (block); // création d'un ItemBlock à partir d'un Block itemBlock.setRegistryName (block.getRegistryName()); // on instancie le nom de registre de l'ItemBlock, c'est le même que celui du Block correspondant : TRES IMPORTANT GameRegistry.register (itemBlock); // on enregistre l'ItemBlock } }
Et au bout d’un moment, il parle de cette classe
BlockModpackage com.tuto.mod.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Items; import net.minecraft.item.Item; public class BlockMod extends Block { public BlockMod(Material materialIn) { super(materialIn); setResistance(3F); setHardness(3F); setHarvestLevel("pickaxe", 3); } }
J’ai eu aussi a enlever le registerRender de mon ClientProxy
package com.tuto.mod.proxy; import com.tuto.mod.client.Modelgardien; import com.tuto.mod.client.RendererMobTuto; import com.tuto.mod.client.RendererTituya; import com.tuto.mod.client.Renderergardien; import com.tuto.mod.common.MobTuto; import com.tuto.mod.common.Tituya; import com.tuto.mod.common.gardien; import com.tuto.mod.init.BiomeMod; import com.tuto.mod.init.BlocksMod; import com.tuto.mod.init.ItemsMod; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerRenders() { ItemsMod.registerRenders(); BiomeMod.init(); RenderingRegistry.registerEntityRenderingHandler(MobTuto.class, new RendererMobTuto(Minecraft.getMinecraft().getRenderManager(), new ModelBiped(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(Tituya.class, new RendererTituya(Minecraft.getMinecraft().getRenderManager(), new ModelBiped(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(gardien.class, new Renderergardien(Minecraft.getMinecraft().getRenderManager(), new Modelgardien(), 0.5F)); } }
Je pense que ma classe principale des blocks doit etre mal faite. Mais je ne sais pas où !
-
.setRegistryName(“”) pour les blocks
Et tu dois passer par ce qu’on appelle une factory pour les mobs, une classe qui implemente IRenderFactory ça évitera les lignes de code dépréciées
-
Et comment utiliser la factory ? Et c’est vraiment important ou pas ?
-
Bah un jour tu verra des erreurs dans ton code, car il auront eu l’envie de virer ces fonctions dépréciés.
C’est simple, voilà un exemple:
public class RenderTest <t extends="" entitytest="">extends RenderLiving <t>{ public static final Factory FACTORY = new Factory(); public RenderTest(RenderManager manager) { super(manager, new ModelTest(), 0.5F); } @Override protected ResourceLocation getEntityTexture(T entity) { return new ResourceLocation(Mod_Test.MODID, "textures/entity/test.png"); } public static class Factory <t extends="" entitytest="">implements IRenderFactory <t>{ @Override public Render createRenderFor(RenderManager manager) { return new RenderTest(manager); } } }
RenderingRegistry.registerEntityRenderingHandler(EntityTest.class, RenderTest.FACTORY); ```</t></t></t></t>
-
donc en gros la factory est par mob ? et remplace la classe Renderer de la 1.9 ?
J’ai fait cela, c’est la classe render de mon mob, j’ai juste deux choses, je choisi quoi pour ModelTest ?, je met le render custom ? mais j’en ai pas, c’est juste un mob simple. Donc je pense mettre ModelBiped.
package com.tuto.mod.client; import com.tuto.mod.References; import com.tuto.mod.common.Tituya; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; public class RendererTituya <t extends="" tituya="">extends RenderLiving <t>{ public static final Factory FACTORY = new Factory(); public RendererTituya(RenderManager manager) { super(manager, new ModelTest(), 0.5F); } @Override protected ResourceLocation getEntityTexture(Tituya entity) { return new ResourceLocation(References.MOD_ID, "textures/entity/tituya.png"); } public static class Factory <t extends="" tituya="">implements IRenderFactory <t>{ @Override public Render createRenderFor(RenderManager manager) { return new RendererTituya(manager); } } }
Et comme ça pour mon client proxy;
RenderingRegistry.registerEntityRenderingHandler(Tituya.class, RendererTituya.FACTORY);
OK, mon jeu ce lance enfin mais… Je n’ai pas mes blocks, mes items spéciaux ne fonctionne pas (stick), un bug au niveau des crafts, mes entités n’ont pas de textures (rectangle blanc) et mon fichier lang a l’air de ne pas fonctionné … C’est chiant les updates …</t></t></t></t>
-
Bah le ModelTest c’est la classe du modèle 3D donc si c’est un biped oui, ModelBiped
-
Up date, toujours pas de réponse pour mes blocks disparues ? J’ai trouvé pour les items, c’est leurs noms, en 1.11, pas de majuscule. Le fichier Lang suis donc aussi. Mais mes entités et mes blocks je sais pas :!
-
Des logs, un crash ? Quelque chose ?