BonjourLeJsonBugué:)
-
Bonjour !
Je suis proche de donner un beau coup de poing dans mon murNon pour vrai, je suis incapable de trouver mon erreur dans mon fichier models qui empêche la texture de mes outils (Tous mes autres blocs/items ont une texture ! J’ai fais la même procédure pourtant…). Le chemin pour aller dans mon fichier JSON est le suivant: assets.breakfight.models.item
Donc voilà le fichier JSON qui s’appelle: toolplatinepickaxe.json
{ "ambientocclusion": false, "textures": { "particle": "breakfight:items/platinepickaxe", "texture": "breakfight:blocks/planks_spruce", "material": "breakfight:blocks/platineblock" }, "elements": [ { "__comment": "Material", "from": [ 1.3125, 1.4375, 7.5 ], "to": [ 18.0625, 2.4375, 8.5 ], "rotation": { "origin": [ 1.3125, 2.4375, 7.5 ], "axis": "z", "angle": 45 }, "faces": { "down": { "uv": [ 13, 8, 3, 7 ], "texture": "#material" }, "up": { "uv": [ 3, 7, 13, 8 ], "texture": "#material" }, "north": { "uv": [ 3, 7, 13, 8.5 ], "texture": "#material" }, "south": { "uv": [ 3, 7, 13, 8 ], "texture": "#material" }, "west": { "uv": [ 12, 7, 13, 8 ], "texture": "#material" }, "east": { "uv": [ 3, 7, 4, 8 ], "texture": "#material" } } }, { "__comment": "Wood", "from": [ 1.5625, 1.6875, 7 ], "to": [ 17.5625, 2.6875, 9 ], "rotation": { "origin": [ 1.5625, 2.6875, 7 ], "axis": "z", "angle": 45 }, "faces": { "down": { "uv": [ 0, 1, 16, 0 ], "texture": "#texture" }, "up": { "uv": [ 0, 0, 16, 1 ], "texture": "#texture" }, "north": { "uv": [ 16, 0, 0, 1 ], "texture": "#texture" }, "south": { "uv": [ 0, 0, 16, 1 ], "texture": "#texture" }, "west": { "uv": [ 0, 0, 1, 1 ], "texture": "#texture" }, "east": { "uv": [ 15, 0, 16, 1 ], "texture": "#texture" } } }, { "__comment": "Wood", "from": [ 1.1875, 1.0625, 7.5 ], "to": [ 17.1875, 3.0625, 8.5 ], "rotation": { "origin": [ 1.1875, 3.0625, 7.5 ], "axis": "z", "angle": 45 }, "faces": { "down": { "uv": [ 0, 1, 16, 0 ], "texture": "#texture" }, "up": { "uv": [ 0, 0, 16, 1 ], "texture": "#texture" }, "north": { "uv": [ 16, 0, 0, 1 ], "texture": "#texture" }, "south": { "uv": [ 0, 0, 16, 1 ], "texture": "#texture" }, "west": { "uv": [ 0, 0, 1, 1 ], "texture": "#texture" }, "east": { "uv": [ 15, 0, 16, 1 ], "texture": "#texture" } } }, { "__comment": "Material", "from": [ 5.8125, 15.6875, 6.5 ], "to": [ 13.8125, 16.6875, 9.5 ], "rotation": { "origin": [ 5.8125, 16.6875, 6.5 ], "axis": "z", "angle": -22.5 }, "faces": { "down": { "uv": [ 6, 11, 9, 3 ], "rotation": 90, "texture": "#material" }, "up": { "uv": [ 6, 12, 9, 4 ], "rotation": 90, "texture": "#material" }, "north": { "uv": [ 6, 4, 7, 12 ], "rotation": 90, "texture": "#material" }, "south": { "uv": [ 6, 12, 7, 4 ], "rotation": 90, "texture": "#material" }, "west": { "uv": [ 6, 4, 9, 5 ], "texture": "#material" }, "east": { "uv": [ 6, 11, 9, 12 ], "texture": "#material" } } }, { "__comment": "Material", "from": [ 12.3125, 5.25, 6.5 ], "to": [ 13.3125, 13.25, 9.5 ], "rotation": { "origin": [ 12.3125, 13.25, 6.5 ], "axis": "z", "angle": 22.5 }, "faces": { "down": { "uv": [ 6, 12, 5, 9 ], "texture": "#material" }, "up": { "uv": [ 5, 9, 6, 12 ], "texture": "#material" }, "north": { "uv": [ 6, 4, 7, 12 ], "texture": "#material" }, "south": { "uv": [ 6, 4, 7, 12 ], "texture": "#material" }, "west": { "uv": [ 6, 4, 9, 12 ], "texture": "#material" }, "east": { "uv": [ 6, 4, 9, 12 ], "texture": "#material" } } }, { "__comment": "Material", "from": [ 6.5625, 15.3125, 7.75 ], "to": [ 19.0625, 15.8125, 8.25 ], "rotation": { "origin": [ 6.5625, 15.8125, 7.75 ], "axis": "z", "angle": -45 }, "faces": { "down": { "uv": [ 3.5, 8, 12.5, 9 ], "texture": "#material" }, "up": { "uv": [ 3.5, 8, 12.5, 9 ], "texture": "#material" }, "north": { "uv": [ 12.5, 8, 3.5, 9 ], "texture": "#material" }, "south": { "uv": [ 3.5, 8, 12.5, 9 ], "texture": "#material" } } } ], "display": { "thirdperson_righthand": { "rotation": [ 0, -90, 55 ], "translation": [ 0, 2, 1 ], "scale": [ 0.85, 0.85, 0.85 ] }, "thirdperson_lefthand": { "rotation": [ 0, 90, -55 ], "translation": [ 0, 2, 1 ], "scale": [ 0.85, 0.85, 0.85 ] }, "head": { "rotation": [ 0, 0, 165 ], "translation": [ 0, 11, 0 ], "scale": [ 1, 1, 1 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0 ], "scale": [ 0.5, 0.5, 0.5 ] }, "fixed": { "rotation": [ 0, 180, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 0.75, 0.75, 0.75 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ 1.13, 2.2, 1.13 ], "scale": [ 0.68, 0.68, 0.68 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 1.13, 2.2, 1.13 ], "scale": [ 0.68, 0.68, 0.68 ] }, "gui": { "rotation": [ 30, 20, 0 ], "translation": [ -1, -0.5, 0 ], "scale": [ 1, 1, 1 ] } } }
J’ai comme nom de classe de mon outil: ToolPlatinePickaxe.java
Et mon item s’appelle: platinePickaxeSi vous avez d’autres besoin, comme une classe quelconque, juste à me le dire et je me ferais un plaisir de vous la transmettre ^^
Je pleure,
merci, infectiion21. -
Salut,
As-tu une erreur dans les logs ? -
Alors, oui il y a plusieurs erreurs dans les logs… J’ai des erreurs qui me disent que j’ai mes items registré 2 fois et je ne comprend pas pourquoi, puisque ça ne m’a jamais fait crash et…
J’ai une erreur à propos de mon model.Je te laisse regarder ça: https://pastebin.com/XnsDe0Cb
je pense avoir trouvé une piste, mais je ne suis pas encore sur.
Dans la classe de mon outil, j’ai ceci:
package fr.breakfight.infectiion21.tools; import fr.breakfight.infectiion21.handlers.ToolsHandler; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemPickaxe; public class ToolPlatinePickaxe extends ItemPickaxe{ public ToolPlatinePickaxe(ToolMaterial material) { super(material); setUnlocalizedName(ToolsHandler.BreakFightTools.PLATINEPICKAXE.getUnlocalizedName()); setRegistryName(ToolsHandler.BreakFightTools.PLATINEPICKAXE.getRegistryName()); setCreativeTab(CreativeTabs.TOOLS); // TODO Auto-generated constructor stub } }
Je pense que le constructor défini seulement le material et non le unlocalizedname + registryname.
Dans mes autres classes, items, il n’y a pas d’argument: ToolMaterial material.
Je ne peux pas l’enlever, puisque c’est le constructor de ‘‘ItemPickaxe’’ de minecraft… Alors je ne sais pas comment arranger ça, si c’est la source du problème.Merci beaucoup
-
ToolsHandler.BreakFightTools.PLATINEPICKAXE.getRegistryName() renvoie quoi ?
-
Ça:
public static enum BreakFightTools {PLATINEPICKAXE(“platinePickaxe”, “ToolPlatinePickaxe”),
PINKSTARPICKAXE(“pinkstarPickaxe”, “ToolPinkstarPickaxe”),
TAFEITEPICKAXE(“tafeitePickaxe”, “ToolTafeitePickaxe”),
PAINITEPICKAXE(“painitePickaxe”, “ToolPainitePickaxe”),PLATINESHOVEL(“platineShovel”, “ToolPlatineShovel”),
PINKSTARSHOVEL(“pinkstarShovel”, “ToolPinkstarShovel”),
TAFEITESHOVEL(“tafeiteShovel”, “ToolTafeiteShovel”),
PAINITESHOVEL(“painiteShovel”, “ToolPainiteShovel”),PLATINEAXE(“platineAxe”, “ToolPlatineAxe”),
PINKSTARAXE(“pinkstarAxe”, “ToolPinkstarAxe”),
TAFEITEAXE(“tafeiteAxe”, “ToolTafeiteAxe”),
PAINITEAXE(“painiteAxe”, “ToolPainiteAxe”),PLATINESWORD(“platineSword”, “ToolPlatineSword”),
PINKSTARSWORD(“pinkstarSword”, “ToolPinkstarSword”),
TAFEITESWORD(“tafeiteSword”, “ToolTafeiteSword”),
PAINITESWORD(“painiteSword”, “ToolPainiteSword”),PLATINEHOE(“platineHoe”, “ToolPlatineHoe”),
PINKSTARHOE(“pinkstarHoe”, “ToolPinkstarHoe”),
TAFEITEHOE(“tafeiteHoe”, “ToolTafeiteHoe”),
PAINITEHOE(“painiteHoe”, “ToolPainiteHoe”);private String unlocalizedName;
private String registryName;BreakFightTools(String unlocalizedName, String registryName) {
this.unlocalizedName = unlocalizedName;
this.registryName = registryName;
}public String getUnlocalizedName() {
return unlocalizedName;
}public String getRegistryName() {
return registryName;
}
} -
Ça:
public static enum BreakFightTools { PLATINEPICKAXE("platinePickaxe", "ToolPlatinePickaxe"), PINKSTARPICKAXE("pinkstarPickaxe", "ToolPinkstarPickaxe"), TAFEITEPICKAXE("tafeitePickaxe", "ToolTafeitePickaxe"), PAINITEPICKAXE("painitePickaxe", "ToolPainitePickaxe"), PLATINESHOVEL("platineShovel", "ToolPlatineShovel"), PINKSTARSHOVEL("pinkstarShovel", "ToolPinkstarShovel"), TAFEITESHOVEL("tafeiteShovel", "ToolTafeiteShovel"), PAINITESHOVEL("painiteShovel", "ToolPainiteShovel"), PLATINEAXE("platineAxe", "ToolPlatineAxe"), PINKSTARAXE("pinkstarAxe", "ToolPinkstarAxe"), TAFEITEAXE("tafeiteAxe", "ToolTafeiteAxe"), PAINITEAXE("painiteAxe", "ToolPainiteAxe"), PLATINESWORD("platineSword", "ToolPlatineSword"), PINKSTARSWORD("pinkstarSword", "ToolPinkstarSword"), TAFEITESWORD("tafeiteSword", "ToolTafeiteSword"), PAINITESWORD("painiteSword", "ToolPainiteSword"), PLATINEHOE("platineHoe", "ToolPlatineHoe"), PINKSTARHOE("pinkstarHoe", "ToolPinkstarHoe"), TAFEITEHOE("tafeiteHoe", "ToolTafeiteHoe"), PAINITEHOE("painiteHoe", "ToolPainiteHoe"); private String unlocalizedName; private String registryName; BreakFightTools(String unlocalizedName, String registryName) { this.unlocalizedName = unlocalizedName; this.registryName = registryName; } public String getUnlocalizedName() { return unlocalizedName; } public String getRegistryName() { return registryName; } }
-
Donc pas de problème à ce niveau.
Le json est bien enregistré ?
-
Bien enregistré… ? C’est à dire ?
edit: c’Est bon j’ai compris ^^
Au pire je te donne ma classe:
package fr.breakfight.infectiion21.handlers; import fr.breakfight.infectiion21.common.BreakfMain; import fr.breakfight.infectiion21.tools.ToolPainiteAxe; import fr.breakfight.infectiion21.tools.ToolPainiteHoe; import fr.breakfight.infectiion21.tools.ToolPainitePickaxe; import fr.breakfight.infectiion21.tools.ToolPainiteShovel; import fr.breakfight.infectiion21.tools.ToolPainiteSword; import fr.breakfight.infectiion21.tools.ToolPinkstarAxe; import fr.breakfight.infectiion21.tools.ToolPinkstarHoe; import fr.breakfight.infectiion21.tools.ToolPinkstarPickaxe; import fr.breakfight.infectiion21.tools.ToolPinkstarShovel; import fr.breakfight.infectiion21.tools.ToolPinkstarSword; import fr.breakfight.infectiion21.tools.ToolPlatineAxe; import fr.breakfight.infectiion21.tools.ToolPlatineHoe; import fr.breakfight.infectiion21.tools.ToolPlatinePickaxe; import fr.breakfight.infectiion21.tools.ToolPlatineShovel; import fr.breakfight.infectiion21.tools.ToolPlatineSword; import fr.breakfight.infectiion21.tools.ToolTafeiteAxe; import fr.breakfight.infectiion21.tools.ToolTafeiteHoe; import fr.breakfight.infectiion21.tools.ToolTafeitePickaxe; import fr.breakfight.infectiion21.tools.ToolTafeiteShovel; import fr.breakfight.infectiion21.tools.ToolTafeiteSword; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemSword; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fml.common.registry.GameRegistry; public class ToolsHandler { public static final ToolMaterial platineMaterial = EnumHelper.addToolMaterial(BreakfMain.MODID + ":platine", 2, 500, 7.0F, 2.5F, 15); public static final ToolMaterial pinkstarMaterial = EnumHelper.addToolMaterial(BreakfMain.MODID + ":pinkstar", 3, 2000, 10.0F, 4.0F, 9); public static final ToolMaterial tafeiteMaterial = EnumHelper.addToolMaterial(BreakfMain.MODID + ":tafeite", 4, 3500, 20.0F, 5.5F, 8); public static final ToolMaterial painiteMaterial = EnumHelper.addToolMaterial(BreakfMain.MODID + ":painite", 5, 5000, 32.0F, 9.25F, 7); public static ItemPickaxe platinePickaxe; public static ItemPickaxe pinkstarPickaxe; public static ItemPickaxe tafeitePickaxe; public static ItemPickaxe painitePickaxe; public static ItemSpade platineShovel; public static ItemSpade pinkstarShovel; public static ItemSpade tafeiteShovel; public static ItemSpade painiteShovel; public static ToolPlatineAxe platineAxe; public static ToolPinkstarAxe pinkstarAxe; public static ToolTafeiteAxe tafeiteAxe; public static ToolPainiteAxe painiteAxe; public static ItemSword platineSword; public static ItemSword pinkstarSword; public static ItemSword tafeiteSword; public static ItemSword painiteSword; public static ItemHoe platineHoe; public static ItemHoe pinkstarHoe; public static ItemHoe tafeiteHoe; public static ItemHoe painiteHoe; public static void init() { platinePickaxe = new ToolPlatinePickaxe(); pinkstarPickaxe = new ToolPinkstarPickaxe(pinkstarMaterial); tafeitePickaxe = new ToolTafeitePickaxe(tafeiteMaterial); painitePickaxe = new ToolPainitePickaxe(painiteMaterial); platineShovel = new ToolPlatineShovel(platineMaterial); pinkstarShovel = new ToolPinkstarShovel(pinkstarMaterial); tafeiteShovel = new ToolTafeiteShovel(tafeiteMaterial); painiteShovel = new ToolPainiteShovel(painiteMaterial); platineAxe = new ToolPlatineAxe(platineMaterial); pinkstarAxe = new ToolPinkstarAxe(pinkstarMaterial); tafeiteAxe = new ToolTafeiteAxe(tafeiteMaterial); painiteAxe = new ToolPainiteAxe(painiteMaterial); platineSword = new ToolPlatineSword(platineMaterial); pinkstarSword = new ToolPinkstarSword(pinkstarMaterial); tafeiteSword = new ToolTafeiteSword(tafeiteMaterial); painiteSword = new ToolPainiteSword(painiteMaterial); platineHoe = new ToolPlatineHoe(platineMaterial); pinkstarHoe = new ToolPinkstarHoe(pinkstarMaterial); tafeiteHoe = new ToolTafeiteHoe(tafeiteMaterial); painiteHoe = new ToolPainiteHoe(painiteMaterial); } public static void register() { GameRegistry.register(platinePickaxe); GameRegistry.register(pinkstarPickaxe); GameRegistry.register(tafeitePickaxe); GameRegistry.register(painitePickaxe); GameRegistry.register(platineShovel); GameRegistry.register(pinkstarShovel); GameRegistry.register(tafeiteShovel); GameRegistry.register(painiteShovel); GameRegistry.register(platineAxe); GameRegistry.register(pinkstarAxe); GameRegistry.register(tafeiteAxe); GameRegistry.register(painiteAxe); GameRegistry.register(platineSword); GameRegistry.register(pinkstarSword); GameRegistry.register(tafeiteSword); GameRegistry.register(painiteSword); GameRegistry.register(platineHoe); GameRegistry.register(pinkstarHoe); GameRegistry.register(tafeiteHoe); GameRegistry.register(painiteHoe); } public static void registerRenders() { registerRender(platinePickaxe); registerRender(pinkstarPickaxe); registerRender(tafeitePickaxe); registerRender(painitePickaxe); registerRender(platineShovel); registerRender(pinkstarShovel); registerRender(tafeiteShovel); registerRender(painiteShovel); registerRender(platineAxe); registerRender(pinkstarAxe); registerRender(tafeiteAxe); registerRender(painiteAxe); registerRender(platineSword); registerRender(pinkstarSword); registerRender(tafeiteSword); registerRender(painiteSword); registerRender(platineHoe); registerRender(pinkstarHoe); registerRender(tafeiteHoe); registerRender(painiteHoe); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } public static enum BreakFightTools { PLATINEPICKAXE("platinePickaxe", "ToolPlatinePickaxe"), PINKSTARPICKAXE("pinkstarPickaxe", "ToolPinkstarPickaxe"), TAFEITEPICKAXE("tafeitePickaxe", "ToolTafeitePickaxe"), PAINITEPICKAXE("painitePickaxe", "ToolPainitePickaxe"), PLATINESHOVEL("platineShovel", "ToolPlatineShovel"), PINKSTARSHOVEL("pinkstarShovel", "ToolPinkstarShovel"), TAFEITESHOVEL("tafeiteShovel", "ToolTafeiteShovel"), PAINITESHOVEL("painiteShovel", "ToolPainiteShovel"), PLATINEAXE("platineAxe", "ToolPlatineAxe"), PINKSTARAXE("pinkstarAxe", "ToolPinkstarAxe"), TAFEITEAXE("tafeiteAxe", "ToolTafeiteAxe"), PAINITEAXE("painiteAxe", "ToolPainiteAxe"), PLATINESWORD("platineSword", "ToolPlatineSword"), PINKSTARSWORD("pinkstarSword", "ToolPinkstarSword"), TAFEITESWORD("tafeiteSword", "ToolTafeiteSword"), PAINITESWORD("painiteSword", "ToolPainiteSword"), PLATINEHOE("platineHoe", "ToolPlatineHoe"), PINKSTARHOE("pinkstarHoe", "ToolPinkstarHoe"), TAFEITEHOE("tafeiteHoe", "ToolTafeiteHoe"), PAINITEHOE("painiteHoe", "ToolPainiteHoe"); private String unlocalizedName; private String registryName; BreakFightTools(String unlocalizedName, String registryName) { this.unlocalizedName = unlocalizedName; this.registryName = registryName; } public String getUnlocalizedName() { return unlocalizedName; } public String getRegistryName() { return registryName; } } }
J’ai beaucoup d’outils, mais aucune des textures marchent alors je me concentrais seulement sur platinepickaxe ^^
-
Ici :
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), “inventory”));
Essaies plutôt :
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(BreakfMain.MODID + item.getRegistryName().toLowerCase(), “inventory”)); -
J’ai trouvé mon problème mdr ! J’avais oublié d’enlever un commentaire ‘’//‘’ dans mes proxy, que j’avais mis pour un test et depuis je n’avais pas pensé de l’enlever x)
Merci tout de même de ton aide !
Sinon, est-ce que je pourrais savoir pourquoi il y a des erreurs dans ma console à propos de l’item qui est register 2 fois 0o ? Car je ne comprend pas trop ^^
Merci encore
-
Le plus probable serait que ta fonction register est appelé deux fois.
-
Mais je ne vois pas en quoi… En tenant compte de la classe que je t’ai donné un peu plus haut, y’aurais vraiment la fonction register 2 fois x) ?
-
Mets un point d’arrêt ou un print dedans, tu verra bien.