Issue with 3d armor model for mcreator .

Started by LordGael22 on Sun, 10/18/2020 - 18:26

Topic category: User side tutorials

Last seen on 21:37, 11. Nov 2020
Joined May 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Issue with 3d armor model for mcreator .
Sun, 10/18/2020 - 18:26

Hello , like many peoples I an issue with a 3d armor model , I checked some other posts and so I don't know where the problem come from , it is a biped model , without  custom rotations , all parts are in they're normal boxes but still it is bugged.

Armor in techne .

 

 

This is how it should look like , very basic .

 

 

look monstruous

 

 

And this is how it loook , very bad with a copy of the full body as an helmet , and a ultra bulky body part .

 

Here is the code of my armor :

 

 

package net.mcreator.wastlanders.item;

import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;

import net.minecraft.util.math.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Item;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.ArmorItem;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.entity.model.BipedModel;

import net.mcreator.wastlanders.WastlandersModElements;

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

@WastlandersModElements.ModElement.Tag
public class VaultjumpsuitItem extends WastlandersModElements.ModElement {
    @ObjectHolder("wastlanders:vaultjumpsuit_helmet")
    public static final Item helmet = null;
    @ObjectHolder("wastlanders:vaultjumpsuit_chestplate")
    public static final Item body = null;
    @ObjectHolder("wastlanders:vaultjumpsuit_leggings")
    public static final Item legs = null;
    @ObjectHolder("wastlanders:vaultjumpsuit_boots")
    public static final Item boots = null;
    public VaultjumpsuitItem(WastlandersModElements instance) {
        super(instance, 144);
    }

    @Override
    public void initElements() {
        IArmorMaterial armormaterial = new IArmorMaterial() {
            public int getDurability(EquipmentSlotType slot) {
                return new int[]{13, 15, 16, 11}[slot.getIndex()] * 25;
            }

            public int getDamageReductionAmount(EquipmentSlotType slot) {
                return new int[]{2, 5, 6, 2}[slot.getIndex()];
            }

            public int getEnchantability() {
                return 9;
            }

            public net.minecraft.util.SoundEvent getSoundEvent() {
                return (net.minecraft.util.SoundEvent) ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("block.wool.step"));
            }

            public Ingredient getRepairMaterial() {
                return Ingredient.fromStacks(new ItemStack(Items.LEATHER, (int) (1)));
            }

            @OnlyIn(Dist.CLIENT)
            public String getName() {
                return "vaultjumpsuit";
            }

            public float getToughness() {
                return 0f;
            }
        };
        elements.items.add(() -> new ArmorItem(armormaterial, EquipmentSlotType.CHEST, new Item.Properties().group(ItemGroup.COMBAT)) {
            @Override
            @OnlyIn(Dist.CLIENT)
            public BipedModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
                BipedModel armorModel = new BipedModel(1);
                armorModel.bipedBody = new Modelvaultjumpsuit().jumpsuit;
                armorModel.bipedLeftArm = new Modelvaultjumpsuit().leftarm;
                armorModel.bipedRightArm = new Modelvaultjumpsuit().rightarm;
                armorModel.isSneak = living.isSneaking();
                armorModel.isSitting = defaultModel.isSitting;
                armorModel.isChild = living.isChild();
                return armorModel;
            }

            @Override
            public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
                return "wastlanders:textures/models/armor/vaultjump__layer_" + (slot == EquipmentSlotType.LEGS ? "2" : "1") + ".png";
            }
        }.setRegistryName("vaultjumpsuit_chestplate"));
        elements.items.add(() -> new ArmorItem(armormaterial, EquipmentSlotType.LEGS, new Item.Properties().group(ItemGroup.COMBAT)) {
            @Override
            @OnlyIn(Dist.CLIENT)
            public BipedModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
                BipedModel armorModel = new BipedModel(1);
                armorModel.bipedLeftLeg = new Modelvaultjumpsuit().leftleg;
                armorModel.bipedRightLeg = new Modelvaultjumpsuit().rightleg;
                armorModel.isSneak = living.isSneaking();
                armorModel.isSitting = defaultModel.isSitting;
                armorModel.isChild = living.isChild();
                return armorModel;
            }

            @Override
            public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
                return "wastlanders:textures/models/armor/vaultjump__layer_" + (slot == EquipmentSlotType.LEGS ? "2" : "1") + ".png";
            }
        }.setRegistryName("vaultjumpsuit_leggings"));
        elements.items.add(() -> new ArmorItem(armormaterial, EquipmentSlotType.FEET, new Item.Properties().group(ItemGroup.COMBAT)) {
            @Override
            @OnlyIn(Dist.CLIENT)
            public BipedModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
                BipedModel armorModel = new BipedModel(1);
                armorModel.bipedLeftLeg = new Modelvaultjumpsuit().leftleg;
                armorModel.bipedRightLeg = new Modelvaultjumpsuit().rightleg;
                armorModel.isSneak = living.isSneaking();
                armorModel.isSitting = defaultModel.isSitting;
                armorModel.isChild = living.isChild();
                return armorModel;
            }

            @Override
            public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
                return "wastlanders:textures/models/armor/vaultjump__layer_" + (slot == EquipmentSlotType.LEGS ? "2" : "1") + ".png";
            }
        }.setRegistryName("vaultjumpsuit_boots"));
    }
    // Made with Blockbench 3.5.4
    // Exported for Minecraft version 1.15
    // Paste this class into your mod and generate all required imports
    public static class Modelvaultjumpsuit extends EntityModel<Entity> {
        private final ModelRenderer jumpsuit;
        private final ModelRenderer leftleg;
        private final ModelRenderer rightleg;
        private final ModelRenderer rightarm;
        private final ModelRenderer leftarm;
        private final ModelRenderer body;
        public Modelvaultjumpsuit() {
            textureWidth = 64;
            textureHeight = 32;
            jumpsuit = new ModelRenderer(this);
            jumpsuit.setRotationPoint(0.0F, 24.0F, 0.0F);
            leftleg = new ModelRenderer(this);
            leftleg.setRotationPoint(2.0F, -12.0F, 0.0F);
            jumpsuit.addChild(leftleg);
            leftleg.setTextureOffset(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.26F, true);
            rightleg = new ModelRenderer(this);
            rightleg.setRotationPoint(-2.0F, -12.0F, 0.0F);
            jumpsuit.addChild(rightleg);
            rightleg.setTextureOffset(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.26F, false);
            rightarm = new ModelRenderer(this);
            rightarm.setRotationPoint(-5.0F, -22.0F, 0.0F);
            jumpsuit.addChild(rightarm);
            rightarm.setTextureOffset(40, 16).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.26F, false);
            leftarm = new ModelRenderer(this);
            leftarm.setRotationPoint(5.0F, -22.0F, 0.0F);
            jumpsuit.addChild(leftarm);
            leftarm.setTextureOffset(40, 16).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, 0.26F, true);
            body = new ModelRenderer(this);
            body.setRotationPoint(0.0F, -24.0F, 0.0F);
            jumpsuit.addChild(body);
            body.setTextureOffset(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, 0.26F, false);
        }

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

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

        public void setRotationAngles(Entity e, float f, float f1, float f2, float f3, float f4) {
            this.rightleg.rotateAngleX = MathHelper.cos(f * 1.0F) * 1.0F * f1;
            this.leftleg.rotateAngleX = MathHelper.cos(f * 1.0F) * -1.0F * f1;
        }
    }
}
 

 

 

 

Thanks you for the help !

Last seen on 21:37, 11. Nov 2020
Joined May 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Solved , sorry for the post …
Mon, 10/19/2020 - 11:10

Solved , sorry for the post , if someone get this too , just make sure you have selected the body part and didn't mistake it with the whole body like me .