Posted March 12, 201510 yr Okay, so i am having troubles with adding in a texture for my block. This is the code i have for the block: package com.pavelow.main; import com.pavelow.lib.RefStrings; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class PavelowOre extends Block { public PavelowOre (Material material) { super(material); setUnlocalizedName("PavelowOre"); setHardness(4.0f); setStepSound(Block.soundTypeStone); setCreativeTab(CreativeTabs.tabBlock); setHarvestLevel("pickaxe",3); } And that works i guess but i think the problem comes down to the main file: @Mod(modid = RefStrings.MODID , name = RefStrings.NAME, version = RefStrings.VERSION) public class mainRegistry { @SidedProxy(clientSide = RefStrings.CLIENTSiDE , serverSide = RefStrings.SERVERSIDE) public static ServerProxy proxy; public final static Block PavelowOre = new PavelowOre(Material.rock); @EventHandler public static void PreLoad(FMLPreInitializationEvent PreEvent) { proxy.registerRenderInfo(); GameRegistry.registerBlock(PavelowOre, "PavelowOre"); } @EventHandler public static void Load(FMLInitializationEvent event) { if(event.getSide() == Side.CLIENT) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(PavelowOre), 0, new ModelResourceLocation(RefStrings.MODID + ":" + PavelowOre.getUnlocalizedName().substring(5), "inventory")); } I have the json files all in the right place and have the right things in it, but i again i think the problem lies in the main files.
March 12, 201510 yr 1. Make use of proxies! Don't EVER do this: if(event.getSide() == Side.CLIENT) 2. proxy.registerRenderInfo(); GameRegistry.registerBlock(PavelowOre, "PavelowOre"); You can't be registering renderers before you register item/block. Also - adding renderers should happen in init(). http://www.minecraftforge.net/forum/index.php/topic,26267.0.html Have look here. 1.7.10 is no longer supported by forge, you are on your own.
March 12, 201510 yr Author Okay so i added the rendering thing to ClientProxy: public class ClientProxy extends ServerProxy{ public void registerRenderInfo() { Item PavelowOre = GameRegistry.findItem("pavelow", "PavelowOre"); ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation("pavelow:PavelowOre", "inventory"); final int DEFAULT_ITEM_SUBTYPE = 0; Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(PavelowOre, DEFAULT_ITEM_SUBTYPE, itemModelResourceLocation); } } And add proxy.registerRenderInfo() to Init but i still get an error when i start up Minecraft.
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.