Posted March 1, 201510 yr I have been making a small mod and I am trying to use a custom model for a sword. The model loads. But it is the pink and black missing texture. I have a texture and supposedly have it bound to the proper location. I don't know why it isn't working. Here is my Main Class package com.jyorke.naturalpowers; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemSword; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.EnumHelper; import com.jyorke.naturalpowers.blocks.block1; import com.jyorke.naturalpowers.blocks.natureFurnace; import com.jyorke.naturalpowers.items.Armor; import com.jyorke.naturalpowers.items.CompoundFuel; import com.jyorke.naturalpowers.items.FoodCroissant; import com.jyorke.naturalpowers.items.NatureSword; import com.jyorke.naturalpowers.items.item1; import com.jyorke.naturalpowers.proxy.ServerProxy; 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.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @Mod(modid = strings.MODID , name = strings.NAME , version = strings.VERSION) public class main { @SidedProxy(clientSide= "com.jyorke.naturalpowers.proxy.ClientProxy", serverSide= "com.jyorke.naturalpowers.proxy.ServerProxy") public static ServerProxy proxy; @Instance(strings.MODID) public static main modInstance; public static ToolMaterial Nature = EnumHelper.addToolMaterial("Nature", 3, 2000, 16.0F, 12.0F, 30); public static ArmorMaterial Nature1 = EnumHelper.addArmorMaterial("Nature1", 30, new int[]{3, 8, 6, 3}, 30); public static CreativeTabs tabCustom = new CreativeTabs("Test") { @Override @SideOnly(Side.CLIENT) public Item getTabIconItem() { return main.ForestCompound; } }; @EventHandler public static void preinit(FMLPreInitializationEvent event) { proxy.registerTileEntities(); proxy.registerRenderThings(); entity1.registerEntity(); ResourceLocation texture = new ResourceLocation("naturalpowers:ModelSword.png"); //Item Ids //Items Croissant = new FoodCroissant(5000, 8, true); GameRegistry.registerItem(Croissant, "Croissant"); item1 = new item1(); GameRegistry.registerItem(item1, "item1"); CompoundFuel = new CompoundFuel(); GameRegistry.registerItem(CompoundFuel, "CompoundFuel"); ForestIngot = new com.jyorke.naturalpowers.items.ForestIngot(); GameRegistry.registerItem(ForestIngot, "ForestIngot"); ForestIngotU = new com.jyorke.naturalpowers.items.ForestIngotU(); GameRegistry.registerItem(ForestIngotU, "ForestIngotU"); ForestRod = new com.jyorke.naturalpowers.items.ForestRod(); GameRegistry.registerItem(ForestRod, "ForestRod"); MiniTree = new com.jyorke.naturalpowers.items.MiniTree(); GameRegistry.registerItem(MiniTree, "MiniTree"); ForestCompound = new com.jyorke.naturalpowers.items.ForestCompound(); GameRegistry.registerItem(ForestCompound, "ForestCompound"); //Blocks final Block block1 = new block1(Material.rock); GameRegistry.registerBlock(block1, "block1"); natureFurnace = new natureFurnace(false).setBlockName("natureFurnace").setCreativeTab(main.tabCustom).setBlockTextureName("nfurnace"); natureFurnaceActive = new natureFurnace(true).setBlockName("natureFurnaceActive").setBlockTextureName("nfurnace2"); GameRegistry.registerBlock(natureFurnaceActive, "natureFurnaceActive"); GameRegistry.registerBlock(natureFurnace, "natureFurnace"); //Tools GameRegistry.registerItem(NatureSword = new NatureSword(Nature), "NatureSword"); GameRegistry.registerItem(NaturePick = new com.jyorke.naturalpowers.items.NaturePick(Nature), "NaturePick"); GameRegistry.registerItem(NatureAxe = new com.jyorke.naturalpowers.items.NatureAxe(Nature), "NatureAxe"); GameRegistry.registerItem(NatureShovel = new com.jyorke.naturalpowers.items.NatureShovel(Nature), "NatureShovel"); //Armor nchest = new Armor(main.Nature1, main.proxy.addArmor("Armor"), 1).setUnlocalizedName("nchest").setCreativeTab(main.tabCustom).setTextureName("naturalpowers:nchest"); ngreaves = new Armor(main.Nature1, main.proxy.addArmor("Armor"), 2).setUnlocalizedName("ngreaves").setCreativeTab(main.tabCustom).setTextureName("naturalpowers:ngreaves"); nboots = new Armor(main.Nature1, main.proxy.addArmor("Armor"), 3).setUnlocalizedName("nboots").setCreativeTab(main.tabCustom).setTextureName("naturalpowers:nboots"); GameRegistry.registerItem(nchest, "nchest"); GameRegistry.registerItem(ngreaves, "ngreaves"); GameRegistry.registerItem(nboots, "nboots"); recipes.main(); } @EventHandler public static void PreLoad(FMLInitializationEvent PreEvent){ proxy.registerNetworkStuff(); proxy.registerItemRenderers(); } //Items + blocks public static Item CompoundFuel; public static Block natureFurnaceActive; public static Block natureFurnace; public static Item item1; public static Block block1; public static ItemSword NatureSword; public static Item NaturePick; public static Item NatureAxe; public static Item NatureShovel; public static Item MiniTree; public static Item ForestRod; public static Item ForestIngot; public static Item ForestIngotU; public static Item ForestCompound; public static Item Croissant; //Armor public static Item nchest; public static Item ngreaves; public static Item nboots; } Here is my Sword's class package com.jyorke.naturalpowers.items; import com.jyorke.naturalpowers.main; import net.minecraft.item.ItemSword; public class NatureSword extends ItemSword{ public NatureSword(ToolMaterial material) { super(material); this.setUnlocalizedName("NatureSword"); this.setCreativeTab(main.tabCustom); } @Override public boolean isFull3D(){ return true; } } Here is the IItemRenderer class package com.jyorke.naturalpowers; import org.lwjgl.opengl.GL11; import com.jyorke.naturalpowers.models.ModelSword; import cpw.mods.fml.common.Mod; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; @SideOnly(Side.CLIENT) public class itemRender implements IItemRenderer { public static final ResourceLocation texture = new ResourceLocation("naturalpowers:ModelSword.png"); private ModelSword swordModel; public itemRender() { this.swordModel = new ModelSword(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: return true; default: return false; } } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type) { case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("naturalpowers:ModelSword.png")); swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); break; } default: break; } } } The model class package com.jyorke.naturalpowers.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelSword extends ModelBase { //fields public ModelRenderer Shape1; public ModelRenderer Shape2; public ModelRenderer Shape3; public ModelRenderer Shape4; public ModelRenderer Shape5; public ModelSword() { textureWidth = 64; textureHeight = 32; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 1, 23, 1); Shape1.setRotationPoint(0F, 1F, 0F); Shape1.setTextureSize(64, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 0, 0); Shape2.addBox(1F, 0F, 0F, 1, 18, 1); Shape2.setRotationPoint(0F, 0F, 0F); Shape2.setTextureSize(64, 32); Shape2.mirror = true; setRotation(Shape2, 0F, 0F, 0F); Shape3 = new ModelRenderer(this, 0, 0); Shape3.addBox(1F, 0F, 0F, 2, 1, 1); Shape3.setRotationPoint(-0.4F, 20F, 0F); Shape3.setTextureSize(64, 32); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, -1.029744F); Shape4 = new ModelRenderer(this, 0, 0); Shape4.addBox(0F, 0F, 0F, 1, 2, 1); Shape4.setRotationPoint(1F, 0F, 0F); Shape4.setTextureSize(64, 32); Shape4.mirror = true; setRotation(Shape4, 0F, 0F, 0.7853982F); Shape5 = new ModelRenderer(this, 0, 0); Shape5.addBox(0F, 0F, 0F, 1, 9, 1); Shape5.setRotationPoint(-0.4F, 1.4F, 0F); Shape5.setTextureSize(64, 32); Shape5.mirror = true; setRotation(Shape5, 0F, 0F, -0.0594858F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Shape1.render(f5); Shape2.render(f5); Shape3.render(f5); Shape4.render(f5); Shape5.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity ent) { super.setRotationAngles(f, f1, f2, f3, f4, f5, ent); } } Client Proxy package com.jyorke.naturalpowers.proxy; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.MinecraftForgeClient; import com.jyorke.naturalpowers.RenderTest; import com.jyorke.naturalpowers.TestMob; import com.jyorke.naturalpowers.entity1; import com.jyorke.naturalpowers.itemRender; import com.jyorke.naturalpowers.main; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends ServerProxy{ public void registerRenderThings(){ RenderingRegistry.registerEntityRenderingHandler(TestMob.class, new RenderTest(new ModelBiped(), 0.5F)); } public int addArmor(String armor){ return RenderingRegistry.addNewArmourRendererPrefix(armor); } public void registerItemRenderers(){ MinecraftForgeClient.registerItemRenderer(main.NatureSword, (IItemRenderer)new itemRender()); } } And finally, the server proxy. package com.jyorke.naturalpowers.proxy; import net.minecraft.client.model.ModelBiped; import net.minecraftforge.client.MinecraftForgeClient; import com.jyorke.naturalpowers.handler.GuiHandler; import com.jyorke.naturalpowers.tile_entity.TileEntityNatureFurnace; import com.jyorke.naturalpowers.itemRender; import com.jyorke.naturalpowers.main; import com.jyorke.naturalpowers.strings; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; public class ServerProxy { public void registerRenderThings(){ } public void registerItemRenderers(){ } public int addArmor(String armor){ return 0; } public void registerNetworkStuff(){ NetworkRegistry.INSTANCE.registerGuiHandler(main.modInstance, new GuiHandler()); } public void registerTileEntities(){ GameRegistry.registerTileEntity(TileEntityNatureFurnace.class, strings.MODID + "TileEntityNatureFurnace"); } public ModelBiped getArmorModel(int id){ return null; }; } Thanks in advance. If you need any more files I can post them. while(awake) { coffee++; }
March 1, 201510 yr well, then the texture needs to be at assets/naturalpowers/ModelSword.png, you probably want new ResourceLocation("naturalpowers:textures/items/ModelSword.png");
March 1, 201510 yr Author well, then the texture needs to be at assets/naturalpowers/ModelSword.png, you probably want new ResourceLocation("naturalpowers:textures/items/ModelSword.png"); Thanks so much! It loaded finally! while(awake) { coffee++; }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.