com.magistuarmory.item.armor.MedievalArmorItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of 1.20.2-epic-knights-common Show documentation
Show all versions of 1.20.2-epic-knights-common Show documentation
mod that adds medieval stuff to the game
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 extends class_1309> getArmorModel(class_1304 slot, class_572 extends class_1309> _default)
{
return slot == this.field_41933.method_48399() && this.model.isPresent() ? this.model.get() : _default;
}
}