Jump to content

[1.7.10] [Solved] Custom Armour Models


Whyneb360

Recommended Posts

Hello again everyone

 

As the title says, I was wandering how you would give a piece of armour a custom model.

 

I already have the armour piece, and it can be equipped/is working fine, and I have a Techne model that I have imported into eclipse and fixed up, but where do I go from there?

 

Any help is greatly appreciated,

 

-Whyneb360

Link to comment
Share on other sites

Do I put the method in the armour class, or under the item itself in my items class (that has all the items for my mod)?

 

Also, where do I translate it and set the texture?

 

P.S. If you could supply some example code, it would definitely help

 

Thanks,

 

- Whyneb360

Link to comment
Share on other sites

I did, to make my backpack wearable..

 

	@Override
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
	return yourmodel;
}

 

 

I try my best, so apologies if I said something obviously stupid!

Link to comment
Share on other sites

Yes, there needs to be a static instance to reference it from another class.

 

But also, the method returns modelBiped, so it looks like you need to create one and set the properties to the correct parts based on the armor slot. I'm just guessing on that though.

Link to comment
Share on other sites

Sure:

 

public class ModelRCPChest extends ModelBiped
{
  //fields
    ModelRenderer shape1;
    ModelRenderer shape2;
    ModelRenderer shape3;
    ModelRenderer shape4;
    ModelRenderer shape5;
    ModelRenderer shape6;
    ModelRenderer shape7;
    ModelRenderer shape8;
    ModelRenderer shape9;
    ModelRenderer shape10;
    ModelRenderer shpae11;
    ModelRenderer shpae12;
    ModelRenderer shpae13;
    ModelRenderer shape14;
    ModelRenderer shpaer15;
    ModelRenderer shpae16;
    ModelRenderer shpaer17;
  
  public ModelRCPChest()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      shape1 = new ModelRenderer(this, 38, 1);
      shape1.addBox(-4.5F, -4F, -3.5F, 6, 5, 7);
      shape1.setRotationPoint(-5F, 2F, 0F);
      shape1.setTextureSize(64, 32);
      shape1.mirror = true;
      setRotation(shape1, 0F, 0F, -0.3490659F);
      shape2 = new ModelRenderer(this, 38, 1);
      shape2.addBox(-1.5F, -4F, -3.5F, 6, 5, 7);
      shape2.setRotationPoint(5F, 2F, 0F);
      shape2.setTextureSize(64, 32);
      shape2.mirror = true;
      setRotation(shape2, 0F, 0F, 0.3490659F);
      shape3 = new ModelRenderer(this, 45, 14);
      shape3.addBox(-0.5F, 0F, -2.5F, 4, 7, 5);
      shape3.setRotationPoint(5F, 2F, 0F);
      shape3.setTextureSize(64, 32);
      shape3.mirror = true;
      setRotation(shape3, 0F, 0F, 0F);
      shape4 = new ModelRenderer(this, 45, 14);
      shape4.addBox(-3.5F, 0F, -2.5F, 4, 7, 5);
      shape4.setRotationPoint(-5F, 2F, 0F);
      shape4.setTextureSize(64, 32);
      shape4.mirror = true;
      setRotation(shape4, 0F, 0F, 0F);
      shape5 = new ModelRenderer(this, 1, 15);
      shape5.addBox(-4.5F, 0F, -2.5F, 9, 11, 5);
      shape5.setRotationPoint(0F, 0F, 0F);
      shape5.setTextureSize(64, 32);
      shape5.mirror = true;
      setRotation(shape5, 0F, 0F, 0F);
      shape6 = new ModelRenderer(this, 1, 7);
      shape6.addBox(-5F, 8F, -3F, 10, 1, 6);
      shape6.setRotationPoint(0F, 0F, 0F);
      shape6.setTextureSize(64, 32);
      shape6.mirror = true;
      setRotation(shape6, 0F, 0F, 0F);
      shape7 = new ModelRenderer(this, 1, 7);
      shape7.addBox(-5F, 5F, -3F, 10, 1, 6);
      shape7.setRotationPoint(0F, 0F, 0F);
      shape7.setTextureSize(64, 32);
      shape7.mirror = true;
      setRotation(shape7, 0F, 0F, 0F);
      shape8 = new ModelRenderer(this, 1, 7);
      shape8.addBox(-5F, 2F, -3F, 10, 1, 6);
      shape8.setRotationPoint(0F, 0F, 0F);
      shape8.setTextureSize(64, 32);
      shape8.mirror = true;
      setRotation(shape8, 0F, 0F, 0F);
      shape9 = new ModelRenderer(this, 1, 7);
      shape9.addBox(-5F, 11F, -3F, 10, 1, 6);
      shape9.setRotationPoint(0F, 0F, 0F);
      shape9.setTextureSize(64, 32);
      shape9.mirror = true;
      setRotation(shape9, 0F, 0F, 0F);
      shape10 = new ModelRenderer(this, 1, 0);
      shape10.addBox(2.4F, 3.4F, -6.4F, 1, 3, 3);
      shape10.setRotationPoint(5F, 2F, 0F);
      shape10.setTextureSize(64, 32);
      shape10.mirror = true;
      setRotation(shape10, 0.7853982F, 0F, 0F);
      shpae11 = new ModelRenderer(this, 1, 0);
      shpae11.addBox(-3.4F, 3.4F, -6.4F, 1, 3, 3);
      shpae11.setRotationPoint(-5F, 2F, 0F);
      shpae11.setTextureSize(64, 32);
      shpae11.mirror = true;
      setRotation(shpae11, 0.7853982F, 0F, 0F);
      shpae12 = new ModelRenderer(this, 10, 1);
      shpae12.addBox(3F, -0.5F, 3F, 2, 2, 1);
      shpae12.setRotationPoint(0F, 0F, 0F);
      shpae12.setTextureSize(64, 32);
      shpae12.mirror = true;
      setRotation(shpae12, 0F, 0F, 0.7853982F);
      shpae13 = new ModelRenderer(this, 10, 1);
      shpae13.addBox(5F, 2F, 3F, 2, 2, 1);
      shpae13.setRotationPoint(0F, 0F, 0F);
      shpae13.setTextureSize(64, 32);
      shpae13.mirror = true;
      setRotation(shpae13, 0F, 0F, 0.7853982F);
      shape14 = new ModelRenderer(this, 10, 1);
      shape14.addBox(-0.2F, 2.7F, 3F, 2, 2, 1);
      shape14.setRotationPoint(0F, 0F, 0F);
      shape14.setTextureSize(64, 32);
      shape14.mirror = true;
      setRotation(shape14, 0F, 0F, 0.7853982F);
      shpaer15 = new ModelRenderer(this, 10, 1);
      shpaer15.addBox(2.3F, 4.8F, 3F, 2, 2, 1);
      shpaer15.setRotationPoint(0F, 0F, 0F);
      shpaer15.setTextureSize(64, 32);
      shpaer15.mirror = true;
      setRotation(shpaer15, 0F, 0F, 0.7853982F);
      shpae16 = new ModelRenderer(this, 31, 15);
      shpae16.addBox(-2.8F, 12F, -2.5F, 1, 5, 5);
      shpae16.setRotationPoint(0F, 0F, 0F);
      shpae16.setTextureSize(64, 32);
      shpae16.mirror = true;
      setRotation(shpae16, 0F, 0F, 0.1745329F);
      shpaer17 = new ModelRenderer(this, 31, 15);
      shpaer17.addBox(1.8F, 11.9F, -2.5F, 1, 5, 5);
      shpaer17.setRotationPoint(0F, 0F, 0F);
      shpaer17.setTextureSize(64, 32);
      shpaer17.mirror = true;
      setRotation(shpaer17, 0F, 0F, -0.1745329F);
  }
  
  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);
    shape10.render(f5);
    shpae11.render(f5);
    shpae12.render(f5);
    shpae13.render(f5);
    shape14.render(f5);
    shpaer15.render(f5);
    shpae16.render(f5);
    shpaer17.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);
  }

}

 

There you go

 

EDIT: Okay, so I redid the model code (and changed it above), and now it renders the model, but it is a bit small, the arms don't move, and it is still textured as the white leather armour

Link to comment
Share on other sites

Okay, so after lots of trial and error, I have this:

 

public class ElementalArmor extends ItemArmor{


public ElementalArmor(ArmorMaterial var1, int var2, int var3) {
	super(var1, var2, var3);
} 

public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
	if(itemStack != null) { 
		if(itemStack.getItem() instanceof ElementalArmor) {
			int type = ((ItemArmor)itemStack.getItem()).armorType;
			if(type == 0) {
				return null;
			}
			if(type == 1) {
				return new ModelRCPChest();
			}
			if(type == 2) {
				return null;
			}
			if(type == 3) {
				return null;
			}
		}
	}
	return null;

}

@Override 
public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, String type) {
	if(itemstack != null) { 
		if(itemstack.getItem() instanceof ElementalArmor) {
			int type1 = ((ItemArmor)itemstack.getItem()).armorType;
			if(type1 == 0) {
				return null;
			}
			if(type1 == 1) {
				return Constants.MODID + ":textures/armor/policeArmorChest.png";
			}
			if(type1 == 2) {
				return null;
			}
			if(type1 == 3) {
				return null;
			}
		}
	}
	return null;

}
}

 

and it works... sort of. The texture is working, and the model is there, but aside from rendering the model that I want for the chest, it also adds random parts of the textures to the legs and head. So to summarise, model and texture work, but extra stuff appears for no apparent reason.

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • no this one https://pastebin.com/5uMxHeWf
    • I am in such a mess. I have lost over 4.7m due to a scammer... It started as bank wires and then bitcoin. it is hard to imagine but it is true and can send any proof, then I tried to use a couple of recovery companies and was as well. Graphic design has been more than just a hobby for me since high school—it has become a thriving career. Starting in my parents' garage, I eventually expanded to my office, running a successful graphic design business. However, like many, I faced the need to diversify my investments due to inflation. This led me to invest 60.16 in Bitcoin, a decision that paid off handsomely as my investment grew to 4.7m over time. This financial windfall allowed me to upgrade my equipment and take on more ambitious projects, furthering the growth of my business. Unfortunately, my excitement was abruptly cut short when I fell victim to a hacking incident. Malware infected my computer, giving hackers access to my Bitcoin wallet. The devastation of potentially losing all my hard-earned savings and plans weighed heavily on me. At this dire moment, a fellow designer suggested Linux Cyber Security Company as a potential solution. Desperate for a lifeline, I reached out to them, hoping for a miracle. The response from Linux Cyber Security Company was prompt, incredibly professional, and effective. Their team quickly traced the hacker’s activities and recovered most of my funds, alleviating a significant amount of stress and uncertainty. Beyond the recovery, they took the time to educate me on essential practices to secure my Bitcoin holdings better. They emphasized using antivirus software to prevent malware infections, avoiding suspicious downloads, and the added security provided by hardware wallets. This experience served as a critical wake-up call for me. It highlighted the vulnerabilities inherent in digital assets and underscored the importance of robust security measures. Thanks to the guidance and expertise of Linux Cyber Security Company, I now feel more equipped to protect my digital assets proactively. Their insights have empowered me to implement stronger security protocols in my business operations and personal finances alike. With my Bitcoin funds securely recovered and a newfound understanding of digital security best practices, I am more confident in navigating future challenges. This journey has reinforced my commitment to safeguarding my hard-earned assets and leveraging technology responsibly. I am optimistic about the growth opportunities ahead, creatively in graphic design and prudently in investment strategies. In conclusion, while the hacking incident was a setback, it ultimately became a catalyst for enhancing my digital security awareness and resilience. I am grateful to Linux Cyber Security Company for their expertise and support during a challenging time, enabling me to continue pursuing my passion for graphic design with renewed confidence and financial stability. Contact a professional company I am sure they can help you with your case too, Website [www.linuxcybersecurity.com Email the team; info@)(linuxcybersecurity.com
    • https://pastebin.com/B2HnBZTa
    • it was easy villager mate, thanks ill see how to do it without that mod! thanks
  • Topics

×
×
  • Create New...

Important Information

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