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

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

The newest version!
package com.magistuarmory.item;

import net.minecraft.class_1304;
import net.minecraft.class_1768;
import net.minecraft.class_1799;
import net.minecraft.class_2487;
import net.minecraft.class_2960;

public class DyeableArmorDecorationItem extends ArmorDecorationItem implements class_1768
{
	int defaultcolor;

	public DyeableArmorDecorationItem(class_2960 location, class_1793 properties, class_1304 armorType)
	{
		this(location, properties, armorType, 16777215);
		this.armorType = armorType;
	}

	public DyeableArmorDecorationItem(class_2960 location, class_1793 properties, class_1304 armorType, int defaultcolor)
	{
		super(location, 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.location.toString());
		compoundnbt.method_10556("dyeable", true);
		compoundnbt.method_10569("color", this.method_7800(stack));
		
		return compoundnbt;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy