com.magistuarmory.item.DyeableArmorDecorationItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of 1.20.2-epic-knights-common Show documentation
Show all versions of 1.20.2-epic-knights-common Show documentation
mod that adds medieval stuff to the game
package com.magistuarmory.item;
import net.minecraft.class_1738;
import net.minecraft.class_1768;
import net.minecraft.class_1799;
import net.minecraft.class_2487;
public class DyeableArmorDecorationItem extends ArmorDecorationItem implements class_1768
{
int defaultcolor;
public DyeableArmorDecorationItem(String name, class_1793 properties, class_1738.class_8051 armorType)
{
this(name, properties, armorType, 16777215);
this.name = name;
this.armorType = armorType;
}
public DyeableArmorDecorationItem(String name, class_1793 properties, class_1738.class_8051 armorType, int defaultcolor)
{
super(name, properties, armorType);
this.defaultcolor = defaultcolor;
}
@Override
public int method_7800(class_1799 stack)
{
class_2487 compoundnbt = stack.method_7941("display");
return compoundnbt != null && compoundnbt.method_10573("color", 99) ? compoundnbt.method_10550("color") : this.defaultcolor;
}
@Override
public class_2487 getCompoundTag(class_1799 stack) {
class_2487 compoundnbt = new class_2487();
compoundnbt.method_10582("name", this.name);
compoundnbt.method_10556("dyeable", true);
compoundnbt.method_10569("color", this.method_7800(stack));
return compoundnbt;
}
}