Résolu GUI/Block
-
Bonjour,
Comment faire un GUI en 1.10.2 ? :interrogation:
Est-ce la même méthode que l’1.7.10 ou cela à t-il changer ? -
J’ai envie de déplacer cette discussion dans les archives et de mettre un avertissement …
-
D’accord, d’accord je coopère !
Mais comment cela fonctionne-t-il en 1.10 ? perso j’ai essayé de faire comme j’avais fait en 1.7 et ça ne fonctionne pas vraiment correctement
-
hum pourrait-on avoir une bout de code, ou même le tuto que tu suit pour tenter de t’aider?
-
A vrais dire je n’est pas vraiment de code j’ai seulement testé quelque chose qui ne fonctionne pas.
Ma question est simplement si le code d’une gui/container/etc… d’un block (1.7.10) est compatible ou du moins presque avec la 1.10. -
Normalement oui
-
Et aussi au niveau des tileentity c’est aussi la même méthode quand 1.7.10 ?
-
Les gui presque rien n’ont changés.
C’est pour ça que je n’ai pas comprit l’intérêt de ta question.
Tu as juste à tester et tu as la réponse plus rapidement que si tu la poses sur le forum …bloc beaucoup de chose ont changés. tile entity il y a aussi quelques trucs qui sont différents.
-
D’accord bah alors j’ai plus qu’a passer mon code 1.7 en 1.10
Je laisse le sujet le temps de le faire ou cas ou j’aurais quelques petits problèmes -
Bon je sais que ce n’est pas vraiment le titre du sujet mais comment on créer un fichier de config ? peut-on le faire avec les Java Properties ?
-
Bon j’ai enfin terminer avec mes GUIs, merci de votre aide!
Mais j’ai un autre problème je cherche comment faire un model custom en json pour un block. J’ai fait quelques tests mais je n’arrive pas a savoir comment fait pour appliquer la texture sur un model custom et aussi comment faire la texture.
(je sais que le nom du sujet n’est pas vraiment adapter a cette nouvelle question mais sa évite d’en recréer un)
-
-
Aie Aie Aie!
Je sais pas trop pourquoi mais le jeux crash a la ligne du GameRegistry.registerBlock(…) de l’un de mes blocks :Description: Initializing game java.lang.IllegalArgumentException: Attempted to register a Block with conflicting names. Old: spyutil:block_ore_copper New: block_ore_copper at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:445) at net.spyman.utils.common.blocks.SpyUtilBlocks.registerBlocks(SpyUtilBlocks.java:26) at net.spyman.utils.SpyUtil.preInit(SpyUtil.java:46) 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.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602) 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 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:239) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217) 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 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:142) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:614) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:257) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) at net.minecraft.client.Minecraft.run(Minecraft.java:386) 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:26) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
[font=Source Code Proimport ]net.minecraft.block.Block%(#aaa9a7)[; ]import net.minecraft.client.renderer.block.model.ModelResourceLocation%(#aaa9a7)[; ]import net.minecraft.item.Item%(#aaa9a7)[; ]import net.minecraftforge.client.model.ModelLoader%(#aaa9a7)[; ]import net.minecraftforge.fml.common.registry.GameRegistry%(#aaa9a7)[; ]import net.minecraftforge.fml.relauncher.Side%(#aaa9a7)[; ]import *net.minecraftforge.fml.relauncher.SideOnly*%(#aaa9a7)[; ]import net.spyman.utils.SpyUtil%(#aaa9a7)[; ] public class %(#345f99)[SpyUtilBlocks ]{ %(#ff537a)[/* Blocks Ores */ ] public static final Block BLOCK_ORE_COPPER = new BlocksOres().setUnlocalizedName("block_ore_copper").setRegistryName("block_ore_copper ")%(#aaa9a7)[; ] public static final Block BLOCK_ORE_TIN = new BlocksOres().setUnlocalizedName("block_ore_tin").setRegistryName("block_ore_tin")%(#aaa9a7)[; ] public static final Block BLOCK_ORE_ALUMINIUM = new BlocksOres().setUnlocalizedName("block_ore_aluminium").setRegistryName("block_ore_aluminium")%(#aaa9a7)[; ] public static final Block BLOCK_ORE_LEAD = new BlocksOres().setUnlocalizedName("block_ore_lead").setRegistryName("block_ore_lead")%(#aaa9a7)[; ] public static final Block BLOCK_ORE_SILVER = new BlocksOres().setUnlocalizedName("block_ore_silver").setRegistryName("block_ore_silver")%(#aaa9a7)[; ] public static void registerBlocks() { GameRegistry.registerBlock(BLOCK_ORE_COPPER, "block_ore_copper")%(#aaa9a7)[; ] GameRegistry.registerBlock(BLOCK_ORE_TIN, "block_ore_tin")%(#aaa9a7)[; ] GameRegistry.registerBlock(BLOCK_ORE_ALUMINIUM, "block_ore_aluminium")%(#aaa9a7)[; ] GameRegistry.registerBlock(BLOCK_ORE_LEAD, "block_ore_lead")%(#aaa9a7)[; ] GameRegistry.registerBlock(BLOCK_ORE_SILVER, "block_ore_silver")%(#aaa9a7)[; ] } *@SideOnly*(Side.CLIENT) public static void registerBlocksModels() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_ALUMINIUM), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_aluminium", "inventory"))%(#aaa9a7)[; ] ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_SILVER), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_silver", "inventory"))%(#aaa9a7)[; ] ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_LEAD), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_lead", "inventory"))%(#aaa9a7)[; ] ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_COPPER), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_copper", "inventory"))%(#aaa9a7)[; ] ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_TIN), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_tin", "inventory"))%(#aaa9a7)[; ] } }
-
GameRegistry.registerBlock(BLOCK_ORE_COPPER, "block_ore_copper");
->
GameRegistry.<block>register(BLOCK_ORE_COPPER);
idem pour les autres.</block>
-
J’ai un npe a la ligne du model registry du block
[font=Source Code Proimport] net.minecraft.block.Block%(#aaa9a7)[; ]import net.minecraft.client.renderer.block.model.ModelResourceLocation%(#aaa9a7)[; ]import net.minecraft.item.Item%(#aaa9a7)[; ]import net.minecraftforge.client.model.ModelLoader%(#aaa9a7)[; ]import net.minecraftforge.fml.common.registry.GameRegistry%(#aaa9a7)[; ]import net.minecraftforge.fml.relauncher.Side%(#aaa9a7)[; ]import *net.minecraftforge.fml.relauncher.SideOnly*%(#aaa9a7)[; ]import net.spyman.utils.SpyUtil%(#aaa9a7)[; ] public class %(#345f99)[SpyUtilBlocks ]{ %(#ff537a)[/* Blocks Ores */ ] public static final Block BLOCK_ORE_COPPER = new BlocksOres().setUnlocalizedName("block_ore_copper").setRegistryName("block_ore_copper ")%(#aaa9a7)[; ] public static final Block BLOCK_ORE_TIN = new BlocksOres().setUnlocalizedName("block_ore_tin").setRegistryName("block_ore_tin")%(#aaa9a7)[; ] public static final Block BLOCK_ORE_ALUMINIUM = new BlocksOres().setUnlocalizedName("block_ore_aluminium").setRegistryName("block_ore_aluminium")%(#aaa9a7)[; ] public static final Block BLOCK_ORE_LEAD = new BlocksOres().setUnlocalizedName("block_ore_lead").setRegistryName("block_ore_lead")%(#aaa9a7)[; ] public static final Block BLOCK_ORE_SILVER = new BlocksOres().setUnlocalizedName("block_ore_silver").setRegistryName("block_ore_silver")%(#aaa9a7)[; ] public static void registerBlocks() { GameRegistry.<Block>register(BLOCK_ORE_COPPER)%(#aaa9a7)[; ] GameRegistry.<Block>register(BLOCK_ORE_TIN)%(#aaa9a7)[; ] GameRegistry.<Block>register(BLOCK_ORE_SILVER)%(#aaa9a7)[; ] GameRegistry.<Block>register(BLOCK_ORE_LEAD)%(#aaa9a7)[; ] GameRegistry.<Block>register(BLOCK_ORE_ALUMINIUM)%(#aaa9a7)[; ] } *@SideOnly*(Side.CLIENT) public static void registerBlocksModels() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_ALUMINIUM), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_aluminium", "inventory"))%(#aaa9a7)[; ] ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_SILVER), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_silver", "inventory"))%(#aaa9a7)[; ] ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_LEAD), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_lead", "inventory"))%(#aaa9a7)[; ] ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_COPPER), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_copper", "inventory"))%(#aaa9a7)[; ] ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(BLOCK_ORE_TIN), 0, new ModelResourceLocation(SpyUtil.PATH + "block_ore_tin", "inventory"))%(#aaa9a7)[; ] } }
Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation(ModelLoader.java:1095) at net.spyman.utils.common.blocks.SpyUtilBlocks.registerBlocksModels(SpyUtilBlocks.java:33) at net.spyman.utils.SpyUtil.preInit(SpyUtil.java:47) 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.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602) 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 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:239) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217) 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 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:142) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:614) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:257) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) at net.minecraft.client.Minecraft.run(Minecraft.java:386) 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:26) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
-
Ah oui, c’est vrai qu’il faut aussi ajouter cette ligne en plus :
GameRegistry.register(new ItemBlock(BLOCK_ORE_COPPER), BLOCK_ORE_COPPER.getRegistryName());
(en dessous du GameRegistry.<block>register et pour chaque bloc).va falloir que je mette à jour mes connaissances pour faire les tuto 1.10 moi …</block>
-
Enfin tout fonctionne merci (je n’imaginais pas qu’il fallait 2 lignes en 1.10)
Et aussi au niveau de ces MERVEILLEUX JSON (NON je ne rage pas!)
Je comprend pas trop pourquoi je n’est pas de texturemodels/block
{ "parent": "block/cube_all", "textures": { "all": "spyutil:blocks/block_ore_copper" } }
blockstates
{ "variants": { "normal": { "model": "spyutil:block_ore_copper" } } }
-
Les fichiers se nomment comment ?
-
(Très le français)
block_ore_copper.json
il sont correctement nommés, me semble t-il
-
public static final Block BLOCK_ORE_COPPER = new BlocksOres().setUnlocalizedName(“block_ore_copper”).setRegistryName("block_ore_copper ");
Il y a un espace en trop ici je crois.Peux-tu envoyer les logs de lancement du jeu ?