3 juin 2014, 16:40

Salut !

J’ai presque réussi a faire tout ce que tu fait dans ton tutoriel mais j’ai rencontré un problème : les textures de mon armure ne s’affiche pas sur mon joueur.
Je te passe ma classe principale et ma class “Armures”:

package fr.blackpandagaming.dragonadventure.common;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraftforge.common.util.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import fr.blackpandagaming.dragonadventure.proxy.CommonProxy;

@Mod(modid = DragonAdventure.MODID, name = "Dragon Adventure", version = "1.0.0")

public class DragonAdventure
{
public static final String MODID = "dragonadventure";
@Instance(MODID)
public static DragonAdventure instance;

@SidedProxy(clientSide = "fr.blackpandagaming.dragonadventure.proxy.ClientProxy", serverSide = "fr.blackpandagaming.dragonadventure.proxy.CommonProxy")
public static CommonProxy proxy;

public static Item batonVert, batonRouge, batonBleu, batonBlanc, batonNoir, dragoniteVerte, dragoniteRouge, dragoniteBleue, dragoniteBlanche, dragoniteNoire, casqueDragoniteBlanche, plastronDragoniteBlanche, pentalonDragoniteBlanche, bottesDragoniteBlanche;

public static ArmorMaterial Armures = EnumHelper.addArmorMaterial("Armures", 25, new int[]{4, 6, 5, 4}, 35);

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
batonVert = new Batons().setUnlocalizedName("batonVert").setTextureName(MODID + ":baton_vert").setCreativeTab(CreativeTabs.tabMaterials);
batonRouge = new Batons().setUnlocalizedName("batonRouge").setTextureName(MODID + ":baton_rouge").setCreativeTab(CreativeTabs.tabMaterials);
batonBleu = new Batons().setUnlocalizedName("batonBleu").setTextureName(MODID + ":baton_bleu").setCreativeTab(CreativeTabs.tabMaterials);
batonBlanc = new Batons().setUnlocalizedName("batonBlanc").setTextureName(MODID + ":baton_blanc").setCreativeTab(CreativeTabs.tabMaterials);
batonNoir = new Batons().setUnlocalizedName("batonNoir").setTextureName(MODID + ":baton_noir").setCreativeTab(CreativeTabs.tabMaterials);

dragoniteVerte = new Batons().setUnlocalizedName("dragoniteVerte").setTextureName(MODID + ":dragonite_verte").setCreativeTab(CreativeTabs.tabMaterials);
dragoniteRouge = new Batons().setUnlocalizedName("dragoniteRouge").setTextureName(MODID + ":dragonite_rouge").setCreativeTab(CreativeTabs.tabMaterials);
dragoniteBleue = new Batons().setUnlocalizedName("dragoniteBleue").setTextureName(MODID + ":dragonite_bleue").setCreativeTab(CreativeTabs.tabMaterials);
dragoniteBlanche = new Batons().setUnlocalizedName("dragoniteBlanche").setTextureName(MODID + ":dragonite_blanche").setCreativeTab(CreativeTabs.tabMaterials);
dragoniteNoire = new Batons().setUnlocalizedName("dragoniteNoire").setTextureName(MODID + ":dragonite_noire").setCreativeTab(CreativeTabs.tabMaterials);

casqueDragoniteBlanche = new Armures(Armures, 0).setUnlocalizedName("casqueDragoniteBlanche").setTextureName(MODID + ":casquedragonite_blanche");
plastronDragoniteBlanche = new Armures(Armures, 1).setUnlocalizedName("plastronDragoniteBlanche").setTextureName(MODID + ":plastrondragonite_blanche");
pentalonDragoniteBlanche = new Armures(Armures, 2).setUnlocalizedName("pentalonDragoniteBlanche").setTextureName(MODID + ":pentalondragonite_blanche");
bottesDragoniteBlanche = new Armures(Armures, 3).setUnlocalizedName("bottesDragoniteBlanche").setTextureName(MODID + ":bottesdragonite_blanche");

GameRegistry.registerItem(batonVert, "baton_vert");
GameRegistry.registerItem(batonRouge, "baton_rouge");
GameRegistry.registerItem(batonBleu, "baton_bleu");
GameRegistry.registerItem(batonBlanc, "baton_blanc");
GameRegistry.registerItem(batonNoir, "baton_noir");

GameRegistry.registerItem(dragoniteVerte, "dragonite_verte");
GameRegistry.registerItem(dragoniteRouge, "dragonite_rouge");
GameRegistry.registerItem(dragoniteBleue, "dragonite_bleue");
GameRegistry.registerItem(dragoniteBlanche, "dragonite_blanche");
GameRegistry.registerItem(dragoniteNoire, "dragonite_noire");

GameRegistry.registerItem(casqueDragoniteBlanche, "casquedragonite_blanche");
GameRegistry.registerItem(plastronDragoniteBlanche, "plastrondragonite_blanche");
GameRegistry.registerItem(pentalonDragoniteBlanche, "pentalondragonite_blanche");
GameRegistry.registerItem(bottesDragoniteBlanche, "bottesdragonite_blanche");
}

@EventHandler
public void init(FMLInitializationEvent event)
{
proxy.registerRender();
}

@EventHandler
public void postInit(FMLPostInitializationEvent event)
{

}
}

Et voici ma class “Armures”:

package fr.blackpandagaming.dragonadventure.common;

import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class Armures extends ItemArmor
{

public Armures(ArmorMaterial material, int type)
{
super(material, 0, type);
}

public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
if(slot == 2)
{
return DragonAdventure.MODID + ":textures/models/armor/DragoniteBlanche_leyer_2";
}
return DragonAdventure.MODID + ":textures/models/armor/DragoniteBlanche_leyer_1";
}

public boolean getIsRepairable(ItemStack input, ItemStack repair)
{
if(repair.getItem() == DragonAdventure.dragoniteBlanche || repair.getItem() == DragonAdventure.dragoniteBlanche)
{
return true;
}
return false;
}

public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
{
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 210, 2));
}
}

Petite précision : mes textures ( DragoniteBlanche_leyer_1 et DragoniteBlanche_leyer_2 ) ont était faites avec novaskin, juste au cas ou… 🙂

Cordialement.