Posted September 17, 201312 yr Hi everyone,i made a model for my item,and loaded it. The problem is it shows INVISIBLE in game...so i think it renders it in a bad way. If you need it, here's the renderer : package DubGun; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainerCreative; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; public class ItemRendererWubGun implements IItemRenderer { protected DubGunRender dubgunmodel; public ItemRendererWubGun() { dubgunmodel = new DubGunRender(); } @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) { // TODO Auto-generated method stub return false; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type) { case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun","textures/models/dg3d.png")); float scale = 1.8F; GL11.glScalef(scale, scale, scale); GL11.glRotatef(10F, 0.8F, 0.0F, 0.0F); //x GL11.glRotatef(-175F, 30.0F, 8.5F, -1.2F); //y GL11.glRotatef(0F, 0.0F, 0.0F, 1.0F); //z dubgunmodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } default: break; } } } Here's the Item in Main Class dubGun = (new ItemWubGun(12905)).setUnlocalizedName("dubgun").setCreativeTab(DubTab).setFull3D(); GameRegistry.addRecipe(new ItemStack(dubGun), new Object[]{"RRR", "RRR", "RRR", 'R', Block.blockDiamond}); //Temporary test Recipe// MinecraftForgeClient.registerItemRenderer(dubGun.itemID, (IItemRenderer)new ItemRendererWubGun()); Any help is appreciated
September 18, 201312 yr Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun","textures/models/dg3d.png")); dubgunmodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); ok so first of all your registering your texture wrong it should this Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun:textures/models/dg3d.png")); or this Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun"+ ":"+"textures/models/dg3d.png")); and as for the render function try replacing data[1] with null and see if that works. if (You.likescoding == false){ You.goaway; }
September 18, 201312 yr No, his texture registering is fine as long as the texture is in: assets/mac_dubstepgun/textures/models/dg3d.png I'd recommend registering the ItemRenderer on client side only.
September 19, 201312 yr you may also want to try having the resource location as a private static final method, then register it like this //this gets the textures private static final ResourceLocation resourceloc = new (ResourceLocation"mac_dubstepgun", "textures/models/dg3d.png"); // this calls the texture FMLClientHandler.instance().getClient().renderEngine.bindTexture(resourceloc); what this means is that your texture path must look like this "/assets/mac_dubstepgun/textures/models/dg3d.png" if (You.likescoding == false){ You.goaway; }
September 19, 201312 yr also try turning this MinecraftForgeClient.registerItemRenderer(dubGun.itemID, (IItemRenderer)new ItemRendererWubGun()); into this because you dont need (IItemRenderer) it extends it therefore it doesn't need to be cast to it. MinecraftForgeClient.registerItemRenderer(dubGun.itemID, new ItemRendererWubGun()); also try putting it in your clientproxy class if (You.likescoding == false){ You.goaway; }
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.