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

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

The newest version!
package com.magistuarmory.item;

import com.magistuarmory.EpicKnights;
import dev.architectury.registry.registries.RegistrySupplier;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import net.minecraft.class_1059;
import net.minecraft.class_1792;
import net.minecraft.class_2378;
import net.minecraft.class_2582;
import net.minecraft.class_2960;
import net.minecraft.class_4722;
import net.minecraft.class_5321;


public class ShieldsSupply extends ItemsSupply
{
	public String shieldName;

	public String woodTexture;
	public String stoneTexture;
	public String ironTexture;
	public String goldTexture;
	public String diamondTexture;
	public String netheriteTexture;

	public String copperTexture;
	public String steelTexture;
	public String silverTexture;
	public String tinTexture;
	public String bronzeTexture;

	public ShieldsSupply(BiFunction> workshop, String shieldName)
	{
		super(workshop, new class_1792.class_1793());

		this.shieldName = shieldName;

		this.woodTexture = "entity/" + ModItemTier.WOOD.getMaterialName() + "_" + shieldName;
		this.stoneTexture = "entity/" + ModItemTier.STONE.getMaterialName() + "_" + shieldName;
		this.ironTexture = "entity/" + ModItemTier.IRON.getMaterialName() + "_" + shieldName;
		this.goldTexture = "entity/" + ModItemTier.GOLD.getMaterialName() + "_" + shieldName;
		this.diamondTexture = "entity/" + ModItemTier.DIAMOND.getMaterialName() + "_" + shieldName;
		this.copperTexture = "entity/" + ModItemTier.COPPER.getMaterialName() + "_" + shieldName;
		this.steelTexture = "entity/" + ModItemTier.STEEL.getMaterialName() + "_" + shieldName;
		this.silverTexture = "entity/" + ModItemTier.SILVER.getMaterialName() + "_" + shieldName;
		this.netheriteTexture = "entity/" + ModItemTier.NETHERITE.getMaterialName() + "_" + shieldName;
		this.tinTexture = "entity/" + ModItemTier.TIN.getMaterialName() + "_" + shieldName;
		this.bronzeTexture = "entity/" + ModItemTier.BRONZE.getMaterialName() + "_" + shieldName;
	}

	public void stitchWithoutPatterns(class_1059 atlas, Consumer adder)
	{
		if (atlas.method_24106() == class_4722.field_21707)
		{
			String[] textures = new String[] { this.woodTexture, this.stoneTexture, this.ironTexture, this.goldTexture, this.diamondTexture, this.netheriteTexture, this.copperTexture, this.steelTexture, this.silverTexture, this.netheriteTexture, this.tinTexture, this.bronzeTexture };
			for (String texture : textures)
			{
				adder.accept(new class_2960(EpicKnights.ID, texture + "_nopattern"));
			}
		}
	}

	public void stitch(class_1059 atlas, Consumer adder)
	{
		if (atlas.method_24106() == class_4722.field_21707)
		{
			String[] textures = new String[] { this.woodTexture, this.stoneTexture, this.ironTexture, this.goldTexture, this.diamondTexture, this.netheriteTexture, this.copperTexture, this.steelTexture, this.silverTexture, this.netheriteTexture, this.tinTexture, this.bronzeTexture };
			for (String texture : textures)
			{
				class_2960 location1 = new class_2960(EpicKnights.ID, texture + "_pattern");
				adder.accept(location1);
				class_2960 location2 = new class_2960(EpicKnights.ID, texture + "_nopattern");
				adder.accept(location2);
			}

			for (class_5321 resourcekey : class_2378.field_39208.method_42021())
			{
				String filename = resourcekey.method_29177().method_12832();
				if (filename.contains(":"))
					filename = filename.split(":")[1];
				class_2960 location = new class_2960(EpicKnights.ID, "entity/" + this.shieldName + "/" + filename);
				adder.accept(location);
			}
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy