Jump to content

Tools not rendering in hand properly


hhggtg3279

Recommended Posts

Ok for some reason my tools are not rendering properly, do you think you can help?

 

ezShVtL.png

 

 

Item Class

 

package top.mod.init;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.SoundEvents;

import net.minecraft.inventory.EntityEquipmentSlot;

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 net.minecraftforge.fml.common.registry.GameRegistry;

import top.mod.armor.toparmor;

import top.mod.main.reference;

import top.mod.tab.toptab;

 

 

public class _items {

 

//items

public static Item copper;

 

//tools

public static Item coppersword;

public static Item copperpick;

public static Item coppershovel;

public static Item copperaxe;

public static Item copperhoe;

 

//armor

public static ArmorMaterial copperarmor = EnumHelper.addArmorMaterial("copperarmor", "tm:copper", 15, new int[]{2, 5, 6, 2}, 9, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial COPPER = EnumHelper.addToolMaterial("COPPER", 1, 181, 6.0F, 2.0F, 14);

 

 

public static Item copperhelm;

public static Item copperchest;

public static Item copperlegs;

public static Item copperboots;

 

 

 

 

public static final void preinit(){

coppersword = registerItem(new coppersword(COPPER), "coppersword");

copperpick = registerItem(new copperpick(COPPER), "copperpick");

coppershovel = registerItem(new coppershovel(COPPER), "coppershovel");

copperaxe = registerItem(new copperaxe(COPPER), "copperaxe");

copperhoe = registerItem(new copperhoe(COPPER), "copperhoe");

 

copperhelm = registerItem(new toparmor(copperarmor, 1, EntityEquipmentSlot.HEAD), "copperhelm");

copperchest = registerItem(new toparmor(copperarmor, 1, EntityEquipmentSlot.CHEST), "copperchest");

copperlegs = registerItem(new toparmor(copperarmor, 2, EntityEquipmentSlot.LEGS), "copperlegs");

copperboots = registerItem(new toparmor(copperarmor, 1, EntityEquipmentSlot.FEET), "copperboots");

 

 

copper = registerItem(new copper(), "copper");

 

}

public static final void registerRenders() {

registerRender(copper);

registerRender(coppersword);

registerRender(copperpick);

registerRender(coppershovel);

registerRender(copperaxe);

registerRender(copperhoe);

registerRender(copperhelm);

registerRender(copperchest);

registerRender(copperlegs);

registerRender(copperboots);

 

}

 

public static final void registerRender(Item i){

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(i,0,

new ModelResourceLocation(reference.MODID + ":" + i.getRegistryName().getResourcePath(), "inventory"));

 

}

 

public static final Item registerItem(Item i, String n){

ResourceLocation r = new ResourceLocation(reference.MODID, n);

 

i.setUnlocalizedName(n);

i.setRegistryName®;

i.setCreativeTab(toptab.toptab);

 

GameRegistry.register(i);

return i;

 

}

}

 

 

 

Link to comment
Share on other sites

1)

What are you even doing here?

reference.MODID + ":" + i.getRegistryName().getResourcePath()

Just use i.getRegistryName.

 

2)

Do not use Minecraft.getMinecraft().getRenderItem().getItemModelMesher(), use ModelLoader.setCustomModelResourceLocation instead. Does the exact same thing, hell of a lot less issues than getItemModelMesher. Needs to be called in preInit rather than init.

 

3)

Tool models have the parent "item/handheld". Be sure to have that as well, and not "item/generated"

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

Like this

 

public static final void preinit(){

 

ModelLoader.setCustomModelResourceLocation.register(i,0,

new ModelResourceLocation(reference.MODID + ":" + i.getRegistryName().getResourcePath(), "inventory"));

 

but this gives me an error "setCustomModelResourceLocation cannot be resolved or is not a field"

 

 

Link to comment
Share on other sites

1)

What are you even doing here?

reference.MODID + ":" + i.getRegistryName().getResourcePath()

Just use i.getRegistryName().

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.