Jump to content

Recommended Posts

Posted (edited)

Never made a post on here before so hopefully those files are readable, been trying to figure out what is going on here, never made custom armor model before so basically just going off of outdated tutorials and changing things as I go, the model works in game but there are some serious issues

package com.chickenwand3.farmbot.objects;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;

import net.minecraft.client.renderer.entity.model.BipedModel;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.util.ResourceLocation;

public abstract class ArmorBaseModel extends BipedModel<LivingEntity>{
	protected final ModelRenderer armorHead;
	protected final ModelRenderer armorBody;
	protected final ModelRenderer armorRightArm;
	protected final ModelRenderer armorLeftArm;
	protected final ModelRenderer armorRightLeg;
	protected final ModelRenderer armorRightBoot;
	protected final ModelRenderer armorLeftLeg;
	protected final ModelRenderer armorLeftBoot;
	
	private String texture;

	public ArmorBaseModel(int textureWidth, int textureHeight, ResourceLocation texture) {
		super(1F);
        this.texWidth = textureWidth;
        this.texHeight = textureHeight;
        this.texture = texture.toString();

        armorHead = new ModelRenderer(this);
        armorHead.setPos(0.0F, 0.0F, 0.0F);
        head.addChild(armorHead);

        armorBody = new ModelRenderer(this);
        armorBody.setPos(0.0F, 0.0F, 0.0F);
        body.addChild(armorBody);
        
        armorRightArm = new ModelRenderer(this);
        armorRightArm.setPos(0.0F, 0.0F, 0.0F);
        rightArm.addChild(armorRightArm);

        armorLeftArm = new ModelRenderer(this);
        armorLeftArm.setPos(0.0F, 0.0F, 0.0F);
        leftArm.addChild(armorLeftArm);

        armorRightLeg = new ModelRenderer(this);
        armorRightLeg.setPos(0.0F, 0.0F, 0.0F);
        rightLeg.addChild(armorRightLeg);

        armorLeftLeg = new ModelRenderer(this);
        armorLeftLeg.setPos(0.0F, 0.0F, 0.0F);
        leftLeg.addChild(armorLeftLeg);


        armorRightBoot = new ModelRenderer(this);
        armorRightBoot.setPos(0.0F, 0.0F, 0.0F);
        rightLeg.addChild(armorRightBoot);

        armorLeftBoot = new ModelRenderer(this);
        armorLeftBoot.setPos(0.0F, 0.0F, 0.0F);
        leftLeg.addChild(armorLeftBoot);
		
		setupArmorParts();
	}

	public abstract void setupArmorParts();

    public final String getTexture(){
        return this.texture;
    }

    /**
     * Feel free to override this method as needed.
     * It's just required to hide armor parts depending on the equipment slot
     */
    @SuppressWarnings("rawtypes")
	public BipedModel applySlot(EquipmentSlotType slot){
        armorHead.visible = false;
        armorBody.visible = false;
        armorRightArm.visible = false;
        armorLeftArm.visible = false;
        armorRightLeg.visible = false;
        armorLeftLeg.visible = false;
        armorRightBoot.visible = false;
        armorLeftBoot.visible = false;

        switch(slot){
            case HEAD:
                armorHead.visible = true;
                break;
            case CHEST:
                armorBody.visible = true;
                armorRightArm.visible = true;
                armorLeftArm.visible = true;
                break;
            case LEGS:
                armorRightLeg.visible = true;
                armorLeftLeg.visible = true;
                break;
            case FEET:
                armorRightBoot.visible = true;
                armorLeftBoot.visible = true;
                break;
            default:
                break;
        }

        return this;
    }

    @SuppressWarnings("rawtypes")
	public final ArmorBaseModel applyEntityStats(BipedModel defaultArmor){
        this.crouching = defaultArmor.crouching;
        this.rightArmPose = defaultArmor.rightArmPose;
        this.leftArmPose = defaultArmor.leftArmPose;

        return this;
    }

    public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
    	super.copyPropertiesTo(this);
        copyModelAngles(this.head, this.armorHead);
        copyModelAngles(this.body, this.armorBody);
        copyModelAngles(this.rightArm, this.armorRightArm);
        copyModelAngles(this.leftArm, this.armorLeftArm);
        copyModelAngles(this.rightLeg, this.armorRightLeg);
        copyModelAngles(this.leftLeg, this.armorLeftLeg);
        copyModelAngles(this.rightLeg, this.armorRightBoot);
        copyModelAngles(this.leftLeg, this.armorLeftBoot);

        matrixStack.pushPose();
        if(crouching) matrixStack.translate(0, 0.2, 0);
        this.armorHead.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
        this.armorBody.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
        this.armorRightArm.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
        this.armorLeftArm.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
        this.armorRightLeg.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
        this.armorLeftLeg.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
        this.armorRightBoot.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
        this.armorLeftBoot.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);

        matrixStack.popPose();
    }

    public final void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.xRot = x;
        modelRenderer.yRot = y;
        modelRenderer.zRot = z;
    }

    private final void copyModelAngles(ModelRenderer in, ModelRenderer out){
        out.xRot = in.xRot;
        out.yRot = in.yRot;
        out.zRot = in.zRot;
    }
}
package com.chickenwand3.farmbot.objects;

import net.minecraft.client.renderer.entity.model.BipedModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public class ArmorRenderer extends ArmorItem{

	
	private ArmorBaseModel armorModel;
	
	public ArmorRenderer(IArmorMaterial material, EquipmentSlotType equipmentSlot, Item.Properties properties, ArmorBaseModel armorModel) {
		super(material, equipmentSlot, properties);
		
		this.armorModel = armorModel;
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
    public final BipedModel getArmorModel(LivingEntity entity, ItemStack itemStack, EquipmentSlotType armorSlot, BipedModel defaultArmor) {
        return armorModel.applyEntityStats(defaultArmor).applySlot(armorSlot);
    }
	
	public final String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
        return armorModel.getTexture();
    }

}
package com.chickenwand3.farmbot.objects;

import net.minecraft.util.ResourceLocation;

public class MyCustomArmorModel extends ArmorBaseModel {

	public MyCustomArmorModel() {
		super(128, 128, new ResourceLocation("farmbot:textures/models/armor/soularmormodel.png"));
	}

	@Override
	public void setupArmorParts() {
		armorHead.setPos(0.0F, 0.0F, 0.0F);
		head.addChild(armorHead);
		armorHead.texOffs(58, 30).addBox(-5.0F, -8.0F, -5.0F, 2.0F, 8.0F, 1.0F, 0.0F, false);
		armorHead.texOffs(18, 11).addBox(-5.0F, -8.0F, -4.0F, 1.0F, 8.0F, 8.0F, 0.0F, false);
		armorHead.texOffs(0, 11).addBox(4.0F, -8.0F, -4.0F, 1.0F, 8.0F, 8.0F, 0.0F, false);
		armorHead.texOffs(30, 0).addBox(-5.0F, -8.0F, 4.0F, 10.0F, 8.0F, 1.0F, 0.0F, false);
		armorHead.texOffs(58, 21).addBox(3.0F, -8.0F, -5.0F, 2.0F, 8.0F, 1.0F, 0.0F, false);
		armorHead.texOffs(28, 16).addBox(-3.0F, -8.0F, -5.0F, 2.0F, 2.0F, 1.0F, 0.0F, false);
		armorHead.texOffs(0, 0).addBox(-5.0F, -9.0F, -5.0F, 10.0F, 1.0F, 10.0F, 0.0F, false);
		armorHead.texOffs(20, 15).addBox(1.0F, -8.0F, -5.0F, 2.0F, 2.0F, 1.0F, 0.0F, false);
		armorHead.texOffs(28, 11).addBox(-1.0F, -8.0F, -5.0F, 2.0F, 4.0F, 1.0F, 0.0F, false);

		armorBody.setPos(0.0F, 0.0F, 0.0F);
		body.addChild(armorBody);
		armorBody.texOffs(18, 27).addBox(-4.0F, 0.0F, 2.0F, 8.0F, 12.0F, 1.0F, 0.0F, false);
		armorBody.texOffs(0, 27).addBox(-4.0F, 0.0F, -3.0F, 8.0F, 12.0F, 1.0F, 0.0F, false);

		armorRightArm.setPos(-7.0F, 0.0F, 0.0F);
		rightArm.addChild(armorRightArm);
		armorRightArm.texOffs(0, 40).addBox(2.0F, -2.0F, -3.0F, 6.0F, 12.0F, 1.0F, 0.0F, false);
		armorRightArm.texOffs(36, 37).addBox(2.0F, -2.0F, 2.0F, 6.0F, 12.0F, 1.0F, 0.0F, false);
		armorRightArm.texOffs(50, 5).addBox(2.0F, -2.0F, -2.0F, 1.0F, 12.0F, 4.0F, 0.0F, false);
		armorRightArm.texOffs(46, 46).addBox(7.0F, -2.0F, -2.0F, 1.0F, 12.0F, 4.0F, 0.0F, false);

		armorLeftArm.setPos(12.0F, 0.0F, 0.0F);
		leftArm.addChild(armorLeftArm);
		armorLeftArm.texOffs(36, 24).addBox(-13.0F, -2.0F, -3.0F, 6.0F, 12.0F, 1.0F, 0.0F, false);
		armorLeftArm.texOffs(36, 11).addBox(-13.0F, -2.0F, 2.0F, 6.0F, 12.0F, 1.0F, 0.0F, false);
		armorLeftArm.texOffs(24, 40).addBox(-13.0F, -2.0F, -2.0F, 1.0F, 12.0F, 4.0F, 0.0F, false);
		armorLeftArm.texOffs(14, 40).addBox(-8.0F, -2.0F, -2.0F, 1.0F, 12.0F, 4.0F, 0.0F, false);

		armorRightLeg.setPos(0.0F, 0.0F, 0.0F);
		rightLeg.addChild(armorRightLeg);
		armorRightLeg.texOffs(50, 29).addBox(6.0F, 0.0F, -2.0F, 0.0F, 12.0F, 4.0F, 0.0F, false);
		armorRightLeg.texOffs(50, 17).addBox(2.0F, 0.0F, -2.0F, 0.0F, 12.0F, 4.0F, 0.0F, false);
		armorRightLeg.texOffs(56, 45).addBox(2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 0.0F, 0.0F, false);
		armorRightLeg.texOffs(24, 56).addBox(2.0F, 0.0F, 2.0F, 4.0F, 12.0F, 0.0F, 0.0F, false);

		armorRightBoot.setPos(0.0F, 0.0F, 0.0F);
		rightLeg.addChild(armorRightBoot);
		armorRightBoot.texOffs(52, 0).addBox(2.0F, 9.0F, -3.0F, 4.0F, 3.0F, 1.0F, 0.0F, false);
		armorRightBoot.texOffs(14, 11).addBox(2.0F, 12.0F, -2.0F, 4.0F, 0.0F, 4.0F, 0.0F, false);
		armorRightBoot.texOffs(0, 14).addBox(2.0F, 9.0F, 2.0F, 4.0F, 3.0F, 0.0F, 0.0F, false);
		armorRightBoot.texOffs(56, 52).addBox(6.0F, 9.0F, -3.0F, 0.0F, 3.0F, 5.0F, 0.0F, false);
		armorRightBoot.texOffs(56, 0).addBox(2.0F, 9.0F, -3.0F, 0.0F, 3.0F, 5.0F, 0.0F, false);

		armorLeftLeg.setPos(-4.0F, 0.0F, 0.0F);
		leftLeg.addChild(armorLeftLeg);
		armorLeftLeg.texOffs(16, 56).addBox(-2.0F, 0.0F, 2.0F, 4.0F, 12.0F, 0.0F, 0.0F, false);
		armorLeftLeg.texOffs(8, 56).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 0.0F, 0.0F, false);
		armorLeftLeg.texOffs(0, 49).addBox(-2.0F, 0.0F, -2.0F, 0.0F, 12.0F, 4.0F, 0.0F, false);
		armorLeftLeg.texOffs(34, 46).addBox(2.0F, 0.0F, -2.0F, 0.0F, 12.0F, 4.0F, 0.0F, false);

		armorLeftBoot.setPos(-4.0F, 0.0F, 0.0F);
		leftLeg.addChild(armorLeftBoot);
		armorLeftBoot.texOffs(10, 10).addBox(-2.0F, 9.0F, -3.0F, 0.0F, 3.0F, 5.0F, 0.0F, false);
		armorLeftBoot.texOffs(0, 0).addBox(2.0F, 9.0F, -3.0F, 0.0F, 3.0F, 5.0F, 0.0F, false);
		armorLeftBoot.texOffs(0, 11).addBox(-2.0F, 9.0F, 2.0F, 4.0F, 3.0F, 0.0F, 0.0F, false);
		armorLeftBoot.texOffs(0, 0).addBox(-2.0F, 9.0F, -3.0F, 4.0F, 3.0F, 1.0F, 0.0F, false);
		armorLeftBoot.texOffs(6, 11).addBox(-2.0F, 12.0F, -2.0F, 4.0F, 0.0F, 4.0F, 0.0F, false);
  }
}


It renders the armor that I want but also adds some of my  texture mashed of the face of the player??

unknown.png

texture.png

Edited by ChickenWand33
Bad code
Posted

 

I speak Spanish and I used a translator to answer you, this is just the armor modeling needs to be implemented in the armor class. look in my profile I have already solved that in 1.15.2 but it also works in 1.16.x

  • 1 month later...
Posted

@Valtiel In your ClientProxy code you are implementing IProxy but in 1.16.5 we have now the MojangMappings, so do you know what IProxy is in 1.16.5?

Posted

Ok. But now I have the problem that my armor is fully rendered, also if I have only one item in my armorslot. And if I turn my armor doesn t turn with my charakter. Here is my code:

ArmorItem

public class LokiArmorItem extends ArmorItem{

    private static final String TEXTURE = FarosVikingsMod.modID + ":textures/armor/loki.png";

    public LokiArmorItem(IArmorMaterial p_i48534_1_, EquipmentSlotType p_i48534_2_, Properties p_i48534_3_) {
        super(p_i48534_1_, p_i48534_2_, p_i48534_3_);
    }



    @SuppressWarnings("unchecked")
    @Nullable
    @Override
    public <A extends BipedModel<?>> A getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlotType slot, A _default) {
        LokiModel model = (slot == EquipmentSlotType.LEGS ? new LokiModel(0.5f) : new LokiModel(1f));

        model.head.visible = slot == EquipmentSlotType.HEAD;
        model.hat.visible = slot == EquipmentSlotType.HEAD;
        model.body.visible = (slot == EquipmentSlotType.CHEST);
        model.rightArm.visible = slot == EquipmentSlotType.CHEST;
        model.leftArm.visible = slot == EquipmentSlotType.CHEST;

        model.rightLeg.visible = (slot == EquipmentSlotType.LEGS)
                || (slot == EquipmentSlotType.FEET);
        model.leftLeg.visible = (slot == EquipmentSlotType.LEGS)
                || (slot == EquipmentSlotType.FEET);
        model.young = _default.young;
        model.crouching = _default.crouching;
        model.riding = _default.riding;
        model.rightArmPose = _default.rightArmPose;
        model.leftArmPose = _default.leftArmPose;

        return (A) model;
    }

    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
        return TEXTURE;
    }

}

Model:

@OnlyIn(Dist.CLIENT)
public class LokiModel extends BipedModel<LivingEntity>{
    private final ModelRenderer Loki;
    private final ModelRenderer cube_r1;
    private final ModelRenderer Head;
    private final ModelRenderer hornV1;
    private final ModelRenderer cube_r2;
    private final ModelRenderer cube_r3;
    private final ModelRenderer cube_r4;
    private final ModelRenderer cube_r5;
    private final ModelRenderer hornV2;
    private final ModelRenderer cube_r6;
    private final ModelRenderer cube_r7;
    private final ModelRenderer cube_r8;
    private final ModelRenderer cube_r9;
    private final ModelRenderer LeftLeg;
    private final ModelRenderer RightLeg;
    private final ModelRenderer LeftArm;
    private final ModelRenderer RightArm;
    private final ModelRenderer Body;


    public LokiModel(float p_i1148_1_) {
        super(p_i1148_1_);
        texWidth = 64;
        texHeight = 64;

        Loki = new ModelRenderer(this);
        Loki.setPos(0.0F, 24.0F, 0.0F);


        cube_r1 = new ModelRenderer(this);
        cube_r1.setPos(0.0F, 0.0F, 0.0F);
        Loki.addChild(cube_r1);
        setRotationAngle(cube_r1, 0.3054F, 0.0F, 0.0F);
        cube_r1.texOffs(34, 38).addBox(-5.0F, -23.0F, 10.0F, 10.0F, 15.0F, 1.0F, 0.0F, false);

        Head = new ModelRenderer(this);
        Head.setPos(0.0F, -24.0F, 0.0F);
        Loki.addChild(Head);
        Head.texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, 1.0F, false);
        Head.texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, 1.5F, false);

        hornV1 = new ModelRenderer(this);
        hornV1.setPos(2.0F, 26.0F, 0.0F);
        Head.addChild(hornV1);
        setRotationAngle(hornV1, -3.1416F, -1.309F, 3.1416F);
        hornV1.texOffs(9, 0).addBox(-3.5F, -36.0F, -2.0F, 3.0F, 1.0F, 3.0F, 0.0F, false);

        cube_r2 = new ModelRenderer(this);
        cube_r2.setPos(3.2132F, -39.5353F, -0.5F);
        hornV1.addChild(cube_r2);
        setRotationAngle(cube_r2, 0.0F, -0.5672F, -0.6981F);
        cube_r2.texOffs(9, 0).addBox(-6.5F, -7.0F, 2.25F, 2.0F, 7.0F, 1.0F, 0.0F, false);
        cube_r2.texOffs(9, 0).addBox(-6.5F, -7.0F, 4.0F, 2.0F, 7.0F, 1.0F, 0.0F, false);

        cube_r3 = new ModelRenderer(this);
        cube_r3.setPos(3.075F, -40.311F, -0.5F);
        hornV1.addChild(cube_r3);
        setRotationAngle(cube_r3, 0.0F, 0.0F, 0.7854F);
        cube_r3.texOffs(9, 0).addBox(-8.875F, -1.25F, -1.0F, 2.0F, 4.0F, 2.0F, 0.0F, false);

        cube_r4 = new ModelRenderer(this);
        cube_r4.setPos(3.1719F, -40.3345F, -0.5F);
        hornV1.addChild(cube_r4);
        setRotationAngle(cube_r4, 0.0F, 0.0F, 0.3491F);
        cube_r4.texOffs(9, 0).addBox(-9.5F, -0.75F, -1.0F, 2.0F, 4.0F, 2.0F, 0.0F, false);

        cube_r5 = new ModelRenderer(this);
        cube_r5.setPos(3.2132F, -39.5353F, -0.5F);
        hornV1.addChild(cube_r5);
        setRotationAngle(cube_r5, 0.0F, 0.0F, -0.6981F);
        cube_r5.texOffs(9, 0).addBox(-7.5F, -7.0F, -1.0F, 2.0F, 7.0F, 2.0F, 0.0F, false);

        hornV2 = new ModelRenderer(this);
        hornV2.setPos(-3.0F, 26.0F, 0.0F);
        Head.addChild(hornV2);
        setRotationAngle(hornV2, 0.0F, -1.1781F, 0.0F);
        hornV2.texOffs(11, 0).addBox(-3.5F, -36.0F, -2.0F, 3.0F, 1.0F, 3.0F, 0.0F, false);

        cube_r6 = new ModelRenderer(this);
        cube_r6.setPos(3.2132F, -39.5353F, -0.5F);
        hornV2.addChild(cube_r6);
        setRotationAngle(cube_r6, 0.0F, -0.5672F, -0.6981F);
        cube_r6.texOffs(11, 0).addBox(-6.5F, -7.0F, 2.25F, 2.0F, 7.0F, 1.0F, 0.0F, false);
        cube_r6.texOffs(11, 0).addBox(-6.5F, -7.0F, 4.0F, 2.0F, 7.0F, 1.0F, 0.0F, false);

        cube_r7 = new ModelRenderer(this);
        cube_r7.setPos(3.075F, -40.311F, -0.5F);
        hornV2.addChild(cube_r7);
        setRotationAngle(cube_r7, 0.0F, 0.0F, 0.7854F);
        cube_r7.texOffs(11, 0).addBox(-8.875F, -1.25F, -1.0F, 2.0F, 4.0F, 2.0F, 0.0F, false);

        cube_r8 = new ModelRenderer(this);
        cube_r8.setPos(3.1719F, -40.3345F, -0.5F);
        hornV2.addChild(cube_r8);
        setRotationAngle(cube_r8, 0.0F, 0.0F, 0.3491F);
        cube_r8.texOffs(11, 0).addBox(-9.5F, -0.75F, -1.0F, 2.0F, 4.0F, 2.0F, 0.0F, false);

        cube_r9 = new ModelRenderer(this);
        cube_r9.setPos(3.2132F, -39.5353F, -0.5F);
        hornV2.addChild(cube_r9);
        setRotationAngle(cube_r9, 0.0F, 0.0F, -0.6981F);
        cube_r9.texOffs(11, 0).addBox(-7.5F, -7.0F, -1.0F, 2.0F, 7.0F, 2.0F, 0.0F, false);

        LeftLeg = new ModelRenderer(this);
        LeftLeg.setPos(1.9F, -12.0F, 0.0F);
        Loki.addChild(LeftLeg);
        LeftLeg.texOffs(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 1.0F, true);

        RightLeg = new ModelRenderer(this);
        RightLeg.setPos(-1.9F, -12.0F, 0.0F);
        Loki.addChild(RightLeg);
        RightLeg.texOffs(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 1.0F, false);

        LeftArm = new ModelRenderer(this);
        LeftArm.setPos(5.0F, -22.0F, 0.0F);
        Loki.addChild(LeftArm);
        LeftArm.texOffs(40, 15).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, 1.0F, true);

        RightArm = new ModelRenderer(this);
        RightArm.setPos(-5.0F, -22.0F, 0.0F);
        Loki.addChild(RightArm);
        RightArm.texOffs(40, 15).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, 1.0F, false);

        Body = new ModelRenderer(this);
        Body.setPos(0.0F, -24.0F, 0.0F);
        Loki.addChild(Body);
        Body.texOffs(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, 1.01F, false);
    }


    @Override
    public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
        Loki.render(matrixStack, buffer, packedLight, packedOverlay);
    }


    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.xRot = x;
        modelRenderer.yRot = y;
        modelRenderer.zRot = z;
    }


}

for the armormaterial I tried both an Enum ArmorMaterial and a class that extends my ArmorItem with an AmorMaterial in it:

public class DLokiArmor extends LokiArmorItem{
    public DLokiArmor(IArmorMaterial p_i48534_1_, EquipmentSlotType p_i48534_2_, Properties p_i48534_3_) {
        super(p_i48534_1_, p_i48534_2_, p_i48534_3_);
    }
    public static final IArmorMaterial LOKI = new IArmorMaterial() {
        private final int[] damageReduction = {7, 9, 10, 6};


        @Override
        public int getDurabilityForSlot(EquipmentSlotType slotType) {
            return 7000;
        }

        @Override
        public int getDefenseForSlot(EquipmentSlotType slotType) {
            return damageReduction[slotType.getIndex()];
        }

        @Override
        public int getEnchantmentValue() {
            return 17;
        }

        @Override
        public SoundEvent getEquipSound() {
            return SoundEvents.ARMOR_EQUIP_DIAMOND;
        }

        @Override
        public Ingredient getRepairIngredient() {
            Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation("minecraft", "diamond"));
            return Ingredient.of(item);
        }

        @Override
        public String getName() {
            return "loki_armor";
        }

        @Override
        public float getToughness() {
            return 3;
        }

        @Override
        public float getKnockbackResistance() {
            return 0;
        }
    };


    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
        if(stack.getItem() == ModItems.LOKI_LEGGINGS.get())
        {
            return FarosVikingsMod.modID + ":" + "/textures/armor/loki.png" ;
        }
        else if(stack.getItem() == ModItems.LOKI_HELMET.get() || stack.getItem() == ModItems.LOKI_CHEST.get() || stack.getItem() == ModItems.LOKI_BOOTS.get())

        {
            return FarosVikingsMod.modID + ":" + "/textures/armor/loki.png" ;
        }
        return null;
    }
}
public enum LokiArmor implements IArmorMaterial {
    LOKI_ARMOR("loki", 7,  new int[]{7, 9, 10, 6}, 17, SoundEvents.ARMOR_EQUIP_LEATHER,2f, 0.1f,()-> Ingredient.of(ModItems.COPPER_INGOT.get()));
    private static final int[] baseDurability = {128, 144, 160, 112};
    private final String name;
    private final int durability;
    private final int[] armorVal;
    private final int enchantability;
    private final SoundEvent equipSound;
    private final float toughniss;
    private final float knockBackResistance;
    private final Ingredient repairMaterial;

    LokiArmor(String name, int durability, int[] armorVal, int enchantability, SoundEvent equipSound, float toughniss, float knockBackResistance, Supplier<Ingredient> repairMaterial) {
        this.name = name;
        this.durability = durability;
        this.armorVal = armorVal;
        this.enchantability = enchantability;
        this.equipSound = equipSound;
        this.toughniss = toughniss;
        this.knockBackResistance = knockBackResistance;
        this.repairMaterial = repairMaterial.get();
    }


    @Override
    public int getDurabilityForSlot(EquipmentSlotType slot) {
        return this.baseDurability[slot.getIndex() ]* this.durability ;
    }

    @Override
    public int getDefenseForSlot(EquipmentSlotType slot) {
        return this.armorVal[slot.getIndex()];
    }

    @Override
    public int getEnchantmentValue() {
        return this.enchantability;
    }

    @Override
    public SoundEvent getEquipSound() {
        return this.equipSound;
    }

    @Override
    public Ingredient getRepairIngredient() {
        return this.repairMaterial;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public float getToughness() {
        return this.toughniss;
    }

    @Override
    public float getKnockbackResistance() {
        return this.knockBackResistance;
    }


}

 

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

    • im new to minecraft java modding and I am looking for some help on adding a custom dimension to minecraft java version 1.21.1   I haven't managed to find a good 1.21.1 minecraft dimension turtorial for intellij modding.  all I could find online is how to make the json files for the custom dimension but not how to setup the custom dimension in the game.    im using forge's recommended version for minecraft 1.21.1, any help would be appreciated
    • Thank you for the suggestion if figure that it should be able to support around 40 based on my previous experiences hosting but no one really seems to have a concrete way of figuring it out. You have been alot more helpful than most people and i will probably set up Linux tomorrow.
    • https://mclo.gs/e8nuqSA My friend and I are having the same issue with this pack. We're trying to play on BMC4 with a bunch of extra mods. The game loads up to 'mod gathering' and then crashes. Mod list changes beyond the modpack: Added mods: alexscaves-2.0.2.jar alexsmobsinteraction-5.4-all.jar Apotheosis-1.20.1-7.4.8.jar ApothicAttributes-1.20.1-1.3.7.jar ApothicCombat-1.20.1-1.1.0.jar ApothicCurios-1.20.1-1.0.3e.jar ArmorPoser-forge-1.20.1-2.2.2.jar ars_nouveau-1.20.1-4.12.7-all.jar attributizer-2.1.jar bendy-lib-forge-4.0.0.jar betterarcheology-1.2.1-1.20.1.jar bettercombat-forge-1.8.6+1.20.1.jar BetterThirdPerson-Forge-1.20-1.9.0.jar born_in_chaos_[Forge]1.20.1_1.7.jar cataclysm_ut_lite-AT - 1.20.1.jar celestisynth-1.20.1-1.3.1.jar cobweb-forge-1.20.1-1.0.1.jar common-networking-forge-1.0.5-1.20.1.jar Critters n' Crawlers-2.2.2-mc1.20.1.jar crittersandcompanions-forge-2.2.2.jar domesticationinnovation-1.7.1-1.20.1.jar dummmmmmy-1.20-2.0.6.jar emotecraft-for-MC1.20.1-2.2.7-b.build.50-forge.jar EmoteTweaks-4.0.2.27-forge.jar exposure-1.20.1-1.7.14-forge.jar faunify-forge-1.20.1-1.1.2.jar hallucinatory_plants-2.3.0-1.20.1-forge.jar Icarus-Forge-2.12.0.jar integrated_api-1.5.1+1.20.1-forge.jar irons_spellbooks-1.20.1-3.4.0.9.jar iwannaskate-1.2.0.jar l2library-2.5.1.jar letsdo-API-forge-1.2.15-forge.jar letsdo-bakery-forge-2.0.5.jar letsdo-brewery-forge-2.0.3.jar letsdo-brewery-forge-2.0.5.jar letsdo-candlelight-forge-2.0.2.jar letsdo-farm_and_charm-forge-1.0.4.jar letsdo-herbalbrews-forge-1.0.12.jar letsdo-nethervinery-forge-1.2.17.jar letsdo-vinery-forge-1.4.39.jar modulargolems-2.5.19.jar mutil-1.20.1-6.2.0.jar Pehkui-3.8.2+1.20.1-forge.jar Placebo-1.20.1-8.6.3.jar player-animation-lib-forge-1.0.2-rc1+1.20.jar Powah-5.0.10.jar productivebees-1.20.1-12.6.0.jar Rats-1.20.1-8.1.3.jar refinedstorage-1.12.4.jar refinedstorageaddons-0.10.0.jar RSInfinityBooster-1.20.1-1.0+41.jar rsjukeboxes-1.20.1-1.0.1.0.jar ScorchedGuns-0.4.1-1.20.1.jar simplyswords-forge-1.56.0-1.20.1.jar sophisticatedbackpacks-1.20.1-3.23.23.1281.jar sophisticatedcore-1.20.1-1.2.75.1033.jar soul-fire-d-forge-1.20.1-4.0.11.jar supermartijn642configlib-1.1.8-forge-mc1.20.jar the_bumblezone-7.7.1+1.20.1-forge.jar the_dirty_stuff-2.1-forge-1.20.1.jar traveloptics-4.4.0-1.20.1.jar unusualprehistory-1.5.0.3.jar voicechat-forge-1.20.1-2.5.30.jar wits-1.1.0+1.20.1-forge.jar xercapaint-1.20.1-1.0.1.jar Updated mods: azurelib (3.0.8 > 3.0.9) lithostitched-forge-1.20.1-1.4.10.jar > lithostitched-forge-1.20.1-1.4.11.jar  
    • Graphics are irrelevant for a server. According to google, it should support 20-40. I literally asked it "how many players on a lightly modded minecraft server will a ryzen 5 2600 with 32GB ram support?" Maybe someone with some real world experience has further input. I can say without a doubt that if you run Linux as opposed to windows for the server operating system, you will get better performance and have more resources available to your server.
    • Could someone help me to figure out what's the problem?  I get this crash when I try to enter to a world in forge 1.12.2:  The game crashed: exception in server tick loop Error: java.lang.NullPointerException: Exception in server tick loop Error code: -1 here is the crash report crash-2025-07-15_20.44.02-server333.txt
  • Topics

×
×
  • Create New...

Important Information

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