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

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

The newest version!
package com.magistuarmory.item;

import net.minecraft.class_1304;
import net.minecraft.class_1792;
import net.minecraft.class_1799;
import net.minecraft.class_1935;
import net.minecraft.class_2487;
import net.minecraft.class_2499;
import net.minecraft.class_2561;
import net.minecraft.class_2960;
import net.minecraft.class_5601;
import org.jetbrains.annotations.NotNull;

public interface ArmorDecoration extends class_1935
{
	class_2960 getResourceLocation();
	
	class_2487 getCompoundTag(class_1799 stack);
	
	class_1304 getArmorType();
	
	boolean isApplicableForDecoration(class_1799 stack);

	default void decorate(class_1799 armorstack, class_1799 decorationstack)
	{
		class_2487 compoundtag = armorstack.method_7941("ArmorDecoration");
		class_2499 listtag = ArmorDecorationItem.getDecorationTags(armorstack);
		class_2487 compoundtag1 = compoundtag != null ? compoundtag.method_10553() : new class_2487();

		class_2487 decorationdata = this.getCompoundTag(decorationstack);
		String name = decorationdata.method_10558("name");

		boolean set = false;
		for (int i = 0; i < listtag.size(); ++i)
		{
			if (listtag.method_10602(i).method_10558("name").equals(name))
			{
				listtag.method_10606(i, decorationdata);
				set = true;
				break;
			}
		}
		if (!set)
		{
			listtag.add(decorationdata);
		}

		compoundtag1.method_10566("Items", listtag);

		armorstack.method_7977(class_2561.method_43469("magistuarmory.decorated", armorstack.method_7964().getString()));
		armorstack.method_7959("ArmorDecoration", compoundtag1);
	}
	
	class_5601 createModelLocation();

	@Override
	default @NotNull class_1792 method_8389()
	{
		return (class_1792) this;
 	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy