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

com.magistuarmory.item.armor.MedievalArmorItem Maven / Gradle / Ivy

There is a newer version: 8.10
Show newest version
package com.magistuarmory.item.armor;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.class_1304;
import net.minecraft.class_1309;
import net.minecraft.class_1738;
import net.minecraft.class_1741;
import net.minecraft.class_5601;
import net.minecraft.class_5617;
import net.minecraft.class_572;
import java.util.Optional;


public class MedievalArmorItem extends class_1738 implements ISurcoat
{
	protected Optional> model = Optional.empty();
	
	public MedievalArmorItem(class_1741 material, class_8051 type, class_1793 properties)
	{
		super(material, type, properties);
	}

	@Environment(EnvType.CLIENT)
	public void loadModel(class_5617.class_5618 context)
	{
		if (this.field_7881 instanceof ArmorType armortype)
		{
			Optional location = armortype.getModelLocation();
			location.ifPresent(loc -> this.model = Optional.of(new class_572<>(context.method_32167(loc))));
		}
	}

	@Environment(EnvType.CLIENT)
	public class_572 getArmorModel(class_1304 slot, class_572 _default)
	{
		return slot == this.field_41933.method_48399() && this.model.isPresent() ? this.model.get() : _default;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy