2022-09-25 22:32:38 +02:00
|
|
|
package com.minelittlepony.unicopia.item;
|
|
|
|
|
2023-09-10 23:14:27 +02:00
|
|
|
import com.minelittlepony.unicopia.compat.trinkets.TrinketsDelegate;
|
2022-09-25 22:32:38 +02:00
|
|
|
|
|
|
|
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
|
|
|
import net.minecraft.entity.EquipmentSlot;
|
|
|
|
import net.minecraft.entity.LivingEntity;
|
|
|
|
import net.minecraft.item.ArmorMaterials;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.sound.SoundEvent;
|
|
|
|
|
|
|
|
public class GlassesItem extends WearableItem {
|
|
|
|
public GlassesItem(FabricItemSettings settings) {
|
|
|
|
super(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public SoundEvent getEquipSound() {
|
|
|
|
return ArmorMaterials.LEATHER.getEquipSound();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-06-02 21:20:30 +02:00
|
|
|
public EquipmentSlot getSlotType(ItemStack stack) {
|
2022-09-25 22:32:38 +02:00
|
|
|
return EquipmentSlot.HEAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isApplicable(LivingEntity entity) {
|
|
|
|
return getForEntity(entity).getItem() == this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ItemStack getForEntity(LivingEntity entity) {
|
2024-02-24 14:06:32 +01:00
|
|
|
return TrinketsDelegate.getInstance(entity).getEquipped(entity, TrinketsDelegate.FACE)
|
2022-09-25 22:32:38 +02:00
|
|
|
.filter(stack -> stack.getItem() instanceof GlassesItem)
|
|
|
|
.findFirst()
|
|
|
|
.orElse(ItemStack.EMPTY);
|
|
|
|
}
|
|
|
|
}
|