Foxyas / Changed-Addon-Rework

MIT License
6 stars 6 forks source link

Abdomen armor of painite #4

Closed Foxyas closed 9 months ago

Foxyas commented 10 months ago

Find the code for make armor

package net.foxyas.changedaddon.item;

import net.ltxprogrammer.changed.entity.variant.LatexVariant;
import net.ltxprogrammer.changed.init.ChangedTabs;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.Nullable;

public class PainiteAbdomenArmor extends AbdomenArmor {
    public static boolean useAbdomenModel(EquipmentSlot slot) {
        return slot == EquipmentSlot.LEGS || slot == EquipmentSlot.FEET;
    }

    public static boolean useInnerAbdomenModel(EquipmentSlot slot) {
        return slot == EquipmentSlot.FEET;
    }

    public PainiteAbdomenArmor(ArmorMaterial material, EquipmentSlot slot, Properties properties) {
        super(material, slot, properties);
    }

    @Override
    public void wearTick(LivingEntity entity, ItemStack itemStack) {} //tick of the armor

    @Override
    public boolean customWearRenderer() {
        return false;
    }

    @Override
    public boolean allowedToKeepWearing(LivingEntity entity) {
        var variant = LatexVariant.getEntityVariant(entity);
        return variant != null && !variant.hasLegs;
    }

    @Nullable
    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, @Nullable String type) {
        String texture = a;//texture local
        String textureFeet = a;//texture local
        return slot.feet ? textureFeet : texture;
    }
}
Foxyas commented 10 months ago

Register code Note Change the tab

public static final RegistryObject<AbdomenArmor> PAINITE_UPPER_ABDOMEN_ARMOR = register("paimite_upper_abdomen_armor",
            () -> new AbdomenArmor(ArmorMaterials.NETHERITE, EquipmentSlot.LEGS, new Item.Properties().tab(ChangedTabs.TAB_CHANGED_COMBAT).fireResistant()));
    public static final RegistryObject<AbdomenArmor> PAINITE_LOWER_ABDOMEN_ARMOR = register("painite_lower_abdomen_armor",
            () -> new AbdomenArmor(ArmorMaterials.NETHERITE, EquipmentSlot.FEET, new Item.Properties().tab(ChangedTabs.TAB_CHANGED_COMBAT).fireResistant()));
Foxyas commented 9 months ago

[Canceled]