Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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;

 

}

}

 

 

 

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.

  • Author

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"

 

 

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.

Where in the world did you get

setCustomModelResourceLocation.register()

from?

setCustomModelResourceLocation()

is a method not a field just use it directly

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.