com.magistuarmory.item.armor.DyeableMedievalArmorItem Maven / Gradle / Ivy
package com.magistuarmory.item.armor;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.DyeableLeatherItem;
import net.minecraft.world.item.ItemStack;
public class DyeableMedievalArmorItem extends MedievalArmorItem implements DyeableLeatherItem
{
int defaultcolor;
public DyeableMedievalArmorItem(ArmorMaterial material, EquipmentSlot type, Properties properties, int defaultcolor)
{
super(material, type, properties);
this.defaultcolor = defaultcolor;
}
@Override
public int m_41121_(ItemStack stack)
{
CompoundTag compoundnbt = stack.m_41737_("display");
return compoundnbt != null && compoundnbt.m_128425_("color", 99) ? compoundnbt.m_128451_("color") : defaultcolor;
}
}