All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.magistuarmory.item.DyeableArmorDecorationItem Maven / Gradle / Ivy

There is a newer version: 8.10
Show newest version
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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy