AnonymousModder Posted February 2, 2016 Share Posted February 2, 2016 I created a model for an item and made all the rendering and item classes, but the model isn't rendering. There is a line through every IItemRenderer, ItemRenderType, ItemRendererHelper, EQUIPPED, EQUIPPED_FIRST_PERSON for some odd reason. Model Class public class ModelLaserArmCannon extends ModelBase { //fields ModelRenderer Shape1; ModelRenderer Shape2; ModelRenderer Shape3; ModelRenderer Shape4; ModelRenderer Shape5; ModelRenderer Shape6; ModelRenderer Shape7; ModelRenderer Shape8; ModelRenderer Shape9; public ModelLaserArmCannon() { textureWidth = 64; textureHeight = 64; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 5, 5, ; Shape1.setRotationPoint(-2.5F, 15F, -3F); Shape1.setTextureSize(64, 64); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 0, 32); Shape2.addBox(0F, 0F, 0F, 1, 2, 1); Shape2.setRotationPoint(-0.5F, 19.7F, 1F); Shape2.setTextureSize(64, 64); Shape2.mirror = true; setRotation(Shape2, -0.3346075F, 0F, 0F); Shape3 = new ModelRenderer(this, 0, 26); Shape3.addBox(0F, 0F, 0F, 1, 1, 4); Shape3.setRotationPoint(-0.5F, 21F, -2.7F); Shape3.setTextureSize(64, 64); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape4 = new ModelRenderer(this, 0, 19); Shape4.addBox(0F, 0F, 0F, 1, 4, 2); Shape4.setRotationPoint(-0.5F, 19.7F, -3F); Shape4.setTextureSize(64, 64); Shape4.mirror = true; setRotation(Shape4, -0.0743572F, 0F, 0F); Shape5 = new ModelRenderer(this, 0, 42); Shape5.addBox(0F, 0F, 0F, 1, 1, 1); Shape5.setRotationPoint(-0.5F, 14F, 4F); Shape5.setTextureSize(64, 64); Shape5.mirror = true; setRotation(Shape5, 0F, 0F, 0F); Shape6 = new ModelRenderer(this, 0, 45); Shape6.addBox(0F, 0F, 0F, 1, 1, 1); Shape6.setRotationPoint(-0.5F, 14F, -3F); Shape6.setTextureSize(64, 64); Shape6.mirror = true; setRotation(Shape6, 0F, 0F, 0F); Shape7 = new ModelRenderer(this, 0, 48); Shape7.addBox(0F, 0F, 0F, 2, 2, 1); Shape7.setRotationPoint(-1F, 12F, -3F); Shape7.setTextureSize(64, 64); Shape7.mirror = true; setRotation(Shape7, 0F, 0F, 0F); Shape8 = new ModelRenderer(this, 27, 0); Shape8.addBox(0F, 0F, 0F, 1, 1, 6); Shape8.setRotationPoint(-3F, 17F, -3F); Shape8.setTextureSize(64, 64); Shape8.mirror = true; setRotation(Shape8, 0F, 0F, 0F); Shape9 = new ModelRenderer(this, 27, 0); Shape9.addBox(0F, 0F, 0F, 1, 1, 6); Shape9.setRotationPoint(2F, 17F, -3F); Shape9.setTextureSize(64, 64); Shape9.mirror = true; setRotation(Shape9, 0F, 0F, 0F); } 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); Shape6.render(f5); Shape7.render(f5); Shape8.render(f5); Shape9.render(f5); } public void renderModel(float f5){ Shape1.render(f5); Shape2.render(f5); Shape3.render(f5); Shape4.render(f5); Shape5.render(f5); Shape6.render(f5); Shape7.render(f5); Shape8.render(f5); Shape9.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 entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } Rendering Class public class RenderLaserArmCannon implements [s]IItemRenderer[/s]{ private ModelLaserArmCannon cannon; public static ResourceLocation texture = new ResourceLocation(Reference.MOD_ID + ":textures/items/laser_arm_cannon_texture.png"); public RenderLaserArmCannon(){ cannon = new ModelLaserArmCannon(); } @Override public boolean handleRenderType(ItemStack item, [s]ItemRenderType[/s] type) { switch(type){ case [s]EQUIPPED[/s]: return true; case [s]EQUIPPED_FIRST_PERSON[/s]: return true; default: return false; } } @Override public boolean shouldUseRenderHelper([s]ItemRenderType[/s] type, ItemStack item, [s]ItemRendererHelper[/s] helper) { return false; } @Override public void renderItem([s]ItemRenderType[/s] type, ItemStack item, Object... data) { switch(type){ case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); this.cannon.renderModel(0.0625F);; GL11.glPopMatrix(); } case [s]EQUIPPED_FIRST_PERSON[/s]: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); boolean isFirstPerson = false; if(data[1] != null && data[1] instanceof EntityPlayer) { if(!((EntityPlayer)data[1] == Minecraft.getMinecraft().getRenderViewEntity() && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative)))) { } else { isFirstPerson = true; } } else { } this.cannon.renderModel(0.0625F);; GL11.glPopMatrix(); } default: break; } } } Line in Main Class MinecraftForgeClient.registerItemRenderer(ModItems.laser_cannon, (IItemRenderer)new RenderLaserArmCannon()); Quote Link to comment Share on other sites More sharing options...
Choonster Posted February 2, 2016 Share Posted February 2, 2016 If you mouseover the names with a line through them, it should tell you that they no longer exist (because they don't). IItemRenderer has been replaced with the model system. You can either create a standard item model in JSON, OBJ or B3D format or create a more dynamic model using one of the interfaces that extend IModel / IBakedModel (e.g. ISmartItemModel ). The Grey Ghost has a post explaining some of the new item rendering system here. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future. Link to comment Share on other sites More sharing options...
Recommended Posts
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.