Jump to content

Recommended Posts

Posted

Hey all. So i have noticed that if view char in 3rd person in custom armor(model) - it makes my RAM rise. I think it's becouse it's creates new layer every frame. Maybe someone know how to fix it? And i'm not good in Java, so explain please for dummy)))
forge-1.12.2-14.23.5.2768


getArmorModel

Spoiler



@Override
	@SideOnly(Side.CLIENT)
	public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot,
			ModelBiped _default) {
		if(itemStack != ItemStack.EMPTY) {
			if(itemStack.getItem() instanceof ItemArmor) {
	        	this.handler = itemStack.getCapability(CapabilityArmorInventory.ADDON_HANDLER, null);

	        	HelmetNordicModel model = new HelmetNordicModel(this.handler);
                model.bipedHead.showModel = armorSlot == EntityEquipmentSlot.HEAD;
				model.bipedHead.showModel = armorSlot == EntityEquipmentSlot.HEAD;
				model.bipedHeadwear.showModel = armorSlot == EntityEquipmentSlot.HEAD;
				
				model.isChild = _default.isChild;
				model.isRiding = _default.isRiding;
				model.isSneak = _default.isSneak;
				model.rightArmPose = _default.rightArmPose;
				model.leftArmPose = _default.leftArmPose;
				
				return model;
			}
		}
		
		return null;
	}


 

 


ModelBiped

Spoiler



package com.seyhadonaar.nordhelm.items.armors.models;

import com.seyhadonaar.nordhelm.init.NordhelmItems;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraftforge.items.IItemHandler;
import net.minecraft.client.renderer.GlStateManager;

public class HelmetNordicModel extends ModelBiped{

    public final ModelRenderer Helmet;
    
    public HelmetNordicModel(IItemHandler handler) {
    	super(1.0F, 0, 156, 69);
        textureWidth = 156;
        textureHeight = 69;

        Helmet = new ModelRenderer(this);
        Helmet.setRotationPoint(0.0F, 0.0F, 0.0F);
        Helmet.cubeList.add(new ModelBox(Helmet, 81, 0, 2.7F, -5.24F, -5.4F, 2, 3, 2, -0.5F, false));
        Helmet.cubeList.add(new ModelBox(Helmet, 93, 4, 2.3F, -3.7F, -5.4F, 2, 2, 2, -0.51F, true));
        Helmet.cubeList.add(new ModelBox(Helmet, 89, 0, 0.8F, -3.3F, -5.4F, 3, 2, 2, -0.52F, true));
        Helmet.cubeList.add(new ModelBox(Helmet, 81, 0, -4.7F, -5.24F, -5.4F, 2, 3, 2, -0.5F, false));
        Helmet.cubeList.add(new ModelBox(Helmet, 93, 4, -4.3F, -3.7F, -5.4F, 2, 2, 2, -0.51F, false));
        Helmet.cubeList.add(new ModelBox(Helmet, 89, 0, -3.8F, -3.3F, -5.4F, 3, 2, 2, -0.52F, false));
        Helmet.cubeList.add(new ModelBox(Helmet, 81, 5, -2.0F, -3.5F, -5.4F, 4, 2, 2, -0.51F, false));
        Helmet.cubeList.add(new ModelBox(Helmet, 64, 37, -5.5F, -6.47F, -5.5F, 11, 3, 11, -0.6F, false));
        Helmet.cubeList.add(new ModelBox(Helmet, 64, 0, -1.5F, -9.4F, -5.65F, 3, 8, 11, -0.54F, false));
        Helmet.cubeList.add(new ModelBox(Helmet, 64, 19, -5.5F, -9.5F, -5.5F, 11, 7, 11, -0.8F, false));
            
        this.bipedHead.addChild(Helmet);
    	
    }
    
    @Override
    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);
    }

    public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }
}


 

 

Posted

1.12 is no longer supported on these forums due to age.

Please update to a modern version to receive support here.

 

More information on supported versions can be found in the LTS link at the top of every page.

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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