Jump to content

[1.12.2] Armor Texture doesn't work


Noob_Master69

Recommended Posts

So I made a custom model for my armor and when I tried it out, the model works but the texture doesn't.

Here's my model code:

package com.galileogalilei.ironmanarmormod.model;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelVArmor extends ModelBiped {
	
    ModelRenderer Headset1;
    ModelRenderer Headset2;
    ModelRenderer Headset3;
    ModelRenderer Spaulder;
  
  public ModelVArmor(float scale) {
	  super(scale, 0, 64, 64);
	  
	  textureWidth = 64;
	  textureHeight = 64;
    
      Headset1 = new ModelRenderer(this, 0, 32);
      Headset1.addBox(4F, -4F, -3F, 1, 2, 2);
      Headset1.setRotationPoint(0F, 0F, 0F);
      Headset1.setTextureSize(64, 32);
      Headset1.mirror = true;
      setRotation(Headset1, 0F, 0F, 0F);
      
      Headset2 = new ModelRenderer(this, 6, 32);
      Headset2.addBox(4F, -2F, -4F, 1, 1, 1);
      Headset2.setRotationPoint(0F, 0F, 0F);
      Headset2.setTextureSize(64, 32);
      Headset2.mirror = true;
      setRotation(Headset2, 0F, 0F, 0F);
      
      Headset3 = new ModelRenderer(this, 10, 32);
      Headset3.addBox(1F, -1F, -5F, 3, 1, 1);
      Headset3.setRotationPoint(0F, 0F, 0F);
      Headset3.setTextureSize(64, 32);
      Headset3.mirror = true;
      setRotation(Headset3, 0F, 0F, 0F);
      
      Spaulder = new ModelRenderer(this, 0, 36);
      Spaulder.addBox(-0.8F, -3.5F, -2F, 5, 5, 5);
      Spaulder.setRotationPoint(0F, 0F, 0F);
      Spaulder.setTextureSize(64, 32);
      Spaulder.mirror = true;
      setRotation(Spaulder, 0F, 0F, 0.3490659F);
      
      bipedHead.addChild(Headset1);
      bipedHead.addChild(Headset2);
      bipedHead.addChild(Headset3);
      bipedLeftArm.addChild(Spaulder);
  }
  
  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);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z) {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
}

And here's the code for my item:

package com.galileogalilei.ironmanarmormod.item;

import com.galileogalilei.ironmanarmormod.Main;
import com.galileogalilei.ironmanarmormod.init.ItemInit;
import com.galileogalilei.ironmanarmormod.model.ModelVArmor;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class ItemMark5Armor extends ItemArmor {

	public ItemMark5Armor(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) {
		super(materialIn, renderIndexIn, equipmentSlotIn);
		this.setCreativeTab(CreativeTabs.COMBAT);
		this.setMaxStackSize(1);
	}
	
	@Override
	public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
		if (player.inventory.armorItemInSlot(3) != null && player.inventory.armorItemInSlot(3).getItem() == ItemInit.MARK_5_HELMET
				&& player.inventory.armorItemInSlot(2) != null && player.inventory.armorItemInSlot(2).getItem() == ItemInit.MARK_5_CHESTPLATE
				&& player.inventory.armorItemInSlot(1) != null && player.inventory.armorItemInSlot(1).getItem() == ItemInit.MARK_5_LEGGINGS
				&& player.inventory.armorItemInSlot(0) != null && player.inventory.armorItemInSlot(0).getItem() == ItemInit.MARK_5_BOOTS) {
			this.effectPlayer(player, Main.FLY_POTION, 0);
		}
	}
	
	private void effectPlayer(EntityPlayer player, Potion potion, int amplifier) {
		if (player.getActivePotionEffect(potion) == null || player.getActivePotionEffect(potion).getDuration() <= 1)
				player.addPotionEffect(new PotionEffect(potion, 159, amplifier, false, false));
	}
	
	@Override
	public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) {
		if(!itemStack.isEmpty()) {
			if(itemStack.getItem() instanceof ItemArmor) {
				
				ModelVArmor armorModel = new ModelVArmor(1.0f);
				ModelVArmor armorModelLegs = new ModelVArmor(0.5f);
				
				armorModel.bipedHead.showModel = armorSlot == EntityEquipmentSlot.HEAD;
				armorModel.bipedHeadwear.showModel = armorSlot == EntityEquipmentSlot.HEAD;
				armorModel.bipedBody.showModel = (armorSlot == EntityEquipmentSlot.CHEST) || (armorSlot == EntityEquipmentSlot.CHEST);
				armorModel.bipedRightArm.showModel = armorSlot == EntityEquipmentSlot.CHEST;
				armorModel.bipedLeftArm.showModel = armorSlot == EntityEquipmentSlot.CHEST;
				armorModelLegs.bipedRightLeg.showModel = (armorSlot == EntityEquipmentSlot.LEGS) || (armorSlot == EntityEquipmentSlot.FEET);
				armorModelLegs.bipedLeftLeg.showModel = (armorSlot == EntityEquipmentSlot.LEGS) || (armorSlot == EntityEquipmentSlot.FEET);

				armorModel.isSneak = _default.isSneak;
				armorModel.isRiding = _default.isRiding;
				armorModel.isChild = _default.isChild;
				armorModel.rightArmPose = _default.rightArmPose;
				armorModel.leftArmPose = _default.leftArmPose;
				
				armorModelLegs.isSneak = _default.isSneak;
				armorModelLegs.isRiding = _default.isRiding;
				armorModelLegs.isChild = _default.isChild;
				armorModelLegs.rightArmPose = _default.rightArmPose;
				armorModelLegs.leftArmPose = _default.leftArmPose;

				return armorModel;
			}
		}
		
		return null;
	}
}

Can anyone help?

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.

Announcements



×
×
  • Create New...

Important Information

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