Jump to content

Recommended Posts

Posted

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());

Posted

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.

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.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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