PROBLEM: Custom Helmet

Started by Derrax1st on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
PROBLEM: Custom Helmet

Hi,

i have problem with helmet's custom 3d mode. I add it with 64x64 textures useing only mcreator options and it will be ok, but in game i see only 1 element of my helmet (core/base). I made helmet with horns and sth like tail and it isn't visable in game.

In code i have:

 

public static class ModelDragonHelmet extends ModelBase {
        // fields
        ModelRenderer baza;
        ModelRenderer ogon;
        ModelRenderer ogon2;
        ModelRenderer rog1;
        ModelRenderer rog2;
        ModelRenderer rog3;

 

and in game is visible only main part called "baza". If i change

 

armorModel.bipedHead = new ModelDragonHelmet().baza;

 

on

 

armorModel.bipedHead = new ModelDragonHelmet().ogon;

 

this second part is displayed correct...how to meka it displayed all parts of model?

 

I tried with: https://www.youtube.com/watch?v=8kMwGESqj28 but when i try to start client it gonna crush. Below full code, i tried many modifications based on this tutoril and i fail all the times. Pls help me...what i should change in code to make it work correct?

 

package net.mcreator.robimyheheszki_test;

import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.event.ModelRegistryEvent;

import net.minecraft.util.ResourceLocation;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.Item;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.Entity;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelBase;

@Elementsrobimyheheszki_test.ModElement.Tag
public class MCreatorDragonArmorHelmet extends Elementsrobimyheheszki_test.ModElement {
    @GameRegistry.ObjectHolder("robimyheheszki_test:dragonarmorhelmethelmet")
    public static final Item helmet = null;
    @GameRegistry.ObjectHolder("robimyheheszki_test:dragonarmorhelmetbody")
    public static final Item body = null;
    @GameRegistry.ObjectHolder("robimyheheszki_test:dragonarmorhelmetlegs")
    public static final Item legs = null;
    @GameRegistry.ObjectHolder("robimyheheszki_test:dragonarmorhelmetboots")
    public static final Item boots = null;

    public MCreatorDragonArmorHelmet(Elementsrobimyheheszki_test instance) {
        super(instance, 21);
    }

    @Override
    public void initElements() {
        ItemArmor.ArmorMaterial enuma = EnumHelper.addArmorMaterial("DRAGONARMORHELMET", "robimyheheszki_test:dragonhelmet_", 25, new int[]{2, 5, 6,
                2}, 9, (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation("block.anvil.destroy")),
                0f);
        elements.items.add(() -> new ItemArmor(enuma, 0, EntityEquipmentSlot.HEAD) {
            @Override
            @SideOnly(Side.CLIENT)
            public ModelBiped getArmorModel(EntityLivingBase living, ItemStack stack, EntityEquipmentSlot slot, ModelBiped defaultModel) {
                ModelBiped armorModel = new ModelBiped();
                armorModel.bipedHead = new ModelDragonHelmet().baza;
                armorModel.isSneak = living.isSneaking();
                armorModel.isRiding = living.isRiding();
                armorModel.isChild = living.isChild();
                return armorModel;
            }

            @Override
            public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
                return "robimyheheszki_test:textures/dragonhelmet_layer_1.png";
            }
        }.setUnlocalizedName("dragonarmorhelmethelmet").setRegistryName("dragonarmorhelmethelmet").setCreativeTab(CreativeTabs.COMBAT));
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void registerModels(ModelRegistryEvent event) {
        ModelLoader.setCustomModelResourceLocation(helmet, 0, new ModelResourceLocation("robimyheheszki_test:dragonarmorhelmethelmet", "inventory"));
    }

    // Date: 2020-01-18 17:01:22
    // Template version 1.1
    // Java generated by Techne
    // Keep in mind that you still need to fill in some blanks
    // - ZeuX
    public static class ModelDragonHelmet extends ModelBase {
        // fields
        ModelRenderer baza;
        ModelRenderer ogon;
        ModelRenderer ogon2;
        ModelRenderer rog1;
        ModelRenderer rog2;
        ModelRenderer rog3;

        public ModelDragonHelmet() {
            textureWidth = 64;
            textureHeight = 64;
            baza = new ModelRenderer(this, 1, 39);
            baza.addBox(-4.5F, -9F, -4.5F, 9, 9, 9);
            baza.setRotationPoint(0F, 0F, 0F);
            baza.setTextureSize(64, 32);
            baza.mirror = true;
            setRotation(baza, 0F, 0F, 0F);
            ogon = new ModelRenderer(this, 59, 1);
            ogon.addBox(-0.5F, 0F, 3.5F, 1, 10, 1);
            ogon.setRotationPoint(0F, 0F, 0F);
            ogon.setTextureSize(64, 32);
            ogon.mirror = true;
            setRotation(ogon, 0F, 0F, 0F);
            ogon2 = new ModelRenderer(this, 37, 0);
            ogon2.addBox(-9F, 7F, 3.5F, 2, 2, 1);
            ogon2.setRotationPoint(0F, 0F, 0F);
            ogon2.setTextureSize(64, 32);
            ogon2.mirror = true;
            setRotation(ogon2, 0F, 0F, -0.7853982F);
            rog1 = new ModelRenderer(this, 44, 0);
            rog1.addBox(-3F, -6F, -9F, 2, 3, 1);
            rog1.setRotationPoint(0F, 0F, 0F);
            rog1.setTextureSize(64, 32);
            rog1.mirror = true;
            setRotation(rog1, -0.8551081F, 0F, 0F);
            rog2 = new ModelRenderer(this, 44, 5);
            rog2.addBox(1F, -6F, -9F, 2, 3, 1);
            rog2.setRotationPoint(0F, 0F, 0F);
            rog2.setTextureSize(64, 32);
            rog2.mirror = true;
            setRotation(rog2, -0.8551081F, 0F, 0F);
            rog3 = new ModelRenderer(this, 51, 0);
            rog3.addBox(-2.5F, -6F, -10.5F, 1, 3, 1);
            rog3.setRotationPoint(0F, 0F, 0F);
            rog3.setTextureSize(64, 32);
            rog3.mirror = true;
            setRotation(rog3, -1.152537F, 0F, 0F);
        }

        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);
            baza.render(f5);
            ogon.render(f5);
            ogon2.render(f5);
            rog1.render(f5);
            rog2.render(f5);
            rog3.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);
        }
    }
}