Jump to content

[1.18.1] boots item renders on legs.


JohnGleb

Recommended Posts

I am trying to create custom armor. I've extended ArmorItem and head, body and legs work just fine. But Feet item renders as pants but with boots scale. I'm a bit confused...

My item classes

public static class Helmet extends BlackChitinArmorItem{

        public Helmet() {
            super(EquipmentSlot.HEAD, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT));
        }

    }

    public static class Chest extends BlackChitinArmorItem{

        public Chest() {
            super(EquipmentSlot.CHEST, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT));
        }

    }

    public static class Pants extends BlackChitinArmorItem{

        public Pants() {
            super(EquipmentSlot.LEGS, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT));
        }

    }

    public static class Boots extends BlackChitinArmorItem{

        public Boots() {
            super(EquipmentSlot.FEET, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT));
        }

    }

My registry

 

    public static final RegistryObject<ArmorItem> CHITIN_HOOD = ITEMS.register("chitin_hood", () -> new ChitinArmorItem.Helmet());
    public static final RegistryObject<ArmorItem> CHITIN_JACKET = ITEMS.register("chitin_jacket", () -> new ChitinArmorItem.Chest());
    public static final RegistryObject<ArmorItem> CHITIN_PANTS = ITEMS.register("chitin_pants", () -> new ChitinArmorItem.Pants());
    public static final RegistryObject<ArmorItem> CHITIN_BOOTS = ITEMS.register("chitin_boots", () -> new ChitinArmorItem.Boots());

 

Link to comment
Share on other sites

1 hour ago, diesieben07 said:

Why did you make these all separate classes?

Show more of your code, specifically BlackChitinArmorItem.

that's because each item has it's own brhaviour, but it does nothing with rendering.
 

public abstract class ChitinArmorItem extends ArmorItem {
    public ChitinArmorItem(EquipmentSlot slot, Properties properties) {
        super(new ArmorMaterial() {
            @Override
            public int getDurabilityForSlot(EquipmentSlot slot) {
                return new int[]{13, 15, 16, 11}[slot.getIndex()] * 25;
            }

            @Override
            public int getDefenseForSlot(EquipmentSlot slot) {
                return new int[]{2, 5, 6, 2}[slot.getIndex()];
            }

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

            @Override
            public SoundEvent getEquipSound() {
                return null;
            }

            @Override
            public Ingredient getRepairIngredient() {
                return Ingredient.of(new ItemStack(EItems.SCORPION_HUSK.get()));
            }

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

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

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

        }, slot, properties);
    }

    @Override
    public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List<Component> p_41423_, TooltipFlag p_41424_) {
        super.appendHoverText(p_41421_,p_41422_,p_41423_,p_41424_);
        p_41423_.add(new TextComponent("Decreases poison duration"));
        p_41423_.add(new TextComponent(" "));
        p_41423_.add(new TextComponent("Wearing full set grants immunity to tier I poison effect"));
    }

    public static class Helmet extends ChitinArmorItem{

        public Helmet() {
            super(EquipmentSlot.HEAD, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT));
        }

        @Override
        public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
            return "evolved_rpg:textures/models/armor/chitin__layer_1.png";
        }

        @Override
        public void onArmorTick(ItemStack itemstack, Level world, Player entity) {
            if(entity.getEffect(MobEffects.POISON) != null){
                MobEffectInstance poison = entity.getEffect(MobEffects.POISON);
                entity.removeEffect(MobEffects.POISON);
                entity.addEffect(new MobEffectInstance(MobEffects.POISON, poison.getDuration()-1));
            }
        }

    }

    public static class Chest extends ChitinArmorItem{

        public Chest() {
            super(EquipmentSlot.CHEST, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT));
        }

        @Override
        public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
            return "evolved_rpg:textures/models/armor/chitin__layer_1.png";
        }

        @Override
        public void onArmorTick(ItemStack itemstack, Level world, Player entity) {
            if(entity.getEffect(MobEffects.POISON) != null){
                MobEffectInstance poison = entity.getEffect(MobEffects.POISON);
                entity.removeEffect(MobEffects.POISON);
                entity.addEffect(new MobEffectInstance(MobEffects.POISON, poison.getDuration()-1));

                if(entity.getItemBySlot(EquipmentSlot.HEAD).getItem() == EItems.CHITIN_HOOD.get() && entity.getItemBySlot(EquipmentSlot.LEGS).getItem() == EItems.CHITIN_PANTS.get() && entity.getItemBySlot(EquipmentSlot.FEET).getItem() == EItems.CHITIN_BOOTS.get()){
                    if (poison.getAmplifier() == 1){
                        entity.removeEffect(MobEffects.POISON);
                    }
                }
            }
        }

    }

    public static class Pants extends ChitinArmorItem{

        public Pants() {
            super(EquipmentSlot.LEGS, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT));
        }

        @Override
        public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
            return "evolved_rpg:textures/models/armor/chitin__layer_2.png";
        }

        @Override
        public void onArmorTick(ItemStack itemstack, Level world, Player entity) {
            if(entity.getEffect(MobEffects.POISON) != null){
                MobEffectInstance poison = entity.getEffect(MobEffects.POISON);
                entity.removeEffect(MobEffects.POISON);
                entity.addEffect(new MobEffectInstance(MobEffects.POISON, poison.getDuration()-1));
            }
        }

    }

    public static class Boots extends ChitinArmorItem{

        public Boots() {
            super(EquipmentSlot.FEET, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT));
        }

        @Override
        public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
            return "evolved_rpg:textures/models/armor/chitin__layer_1.png";
        }

        @Override
        public void onArmorTick(ItemStack itemstack, Level world, Player entity) {
            if(entity.getEffect(MobEffects.POISON) != null){
                MobEffectInstance poison = entity.getEffect(MobEffects.POISON);
                entity.removeEffect(MobEffects.POISON);
                entity.addEffect(new MobEffectInstance(MobEffects.POISON, poison.getDuration()-1));
            }
        }

    }
}

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So the default PlayerModel contains this code here to set the players arms to slim   if (pSlim) { $$3.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, pCubeDeformation), PartPose.offset(5.0F, 2.5F, 0.0F)); $$3.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(40, 16).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, pCubeDeformation), PartPose.offset(-5.0F, 2.5F, 0.0F)); $$3.addOrReplaceChild("left_sleeve", CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, pCubeDeformation.extend(0.25F)), PartPose.offset(5.0F, 2.5F, 0.0F)); $$3.addOrReplaceChild("right_sleeve", CubeListBuilder.create().texOffs(40, 32).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 12.0F, 4.0F, pCubeDeformation.extend(0.25F)), PartPose.offset(-5.0F, 2.5F, 0.0F)); } else { $$3.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, pCubeDeformation), PartPose.offset(5.0F, 2.0F, 0.0F)); $$3.addOrReplaceChild("left_sleeve", CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, pCubeDeformation.extend(0.25F)), PartPose.offset(5.0F, 2.0F, 0.0F)); $$3.addOrReplaceChild("right_sleeve", CubeListBuilder.create().texOffs(40, 32).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, pCubeDeformation.extend(0.25F)), PartPose.offset(-5.0F, 2.0F, 0.0F)); } And that's got me thinking. If I can't replace the whole model in one fell swoop, what if I replaced each individual limb with my models mesh definitions? Note: It was crazy. The createMesh method in PlayerModel could not be @Overriden and addOrReplaceChild just makes changes to a new model that uses the original as a base.     However, I did render my model using this   final toatestentity idk = entities.toatest.get().create(p.level()); Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(idk).render(idk, 0f, pTicks, stack, buffer, paLights); However that just uses the render from the entity I used to test getting the model to render in the first place. I don't want to do that. I want to fully replace the player model which this doesn't actually do (I don't think?).  Maybe it'd just be best to render my model as a new layer and make the base player model invisible? Maybe I'll take a look at how armor is rendered to move with the player so I won't have to make my own animations? Idk, I'm really set on figuring this out though.
    • AT Launcher works just fine
    • Make a test with another Launcher like MultiMC or AT Launcher  
    • https://mclo.gs/EZ0jeA2
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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