Fixed not being able to equip amulets, bracelets, and necklaces when trinkets is not installed

This commit is contained in:
Sollace 2023-11-25 20:49:47 +00:00
parent e45ec6e1ff
commit c8dc41a68e
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 4 additions and 3 deletions

View file

@ -6,6 +6,7 @@ import java.util.stream.Stream;
import com.minelittlepony.unicopia.EntityConvertable; import com.minelittlepony.unicopia.EntityConvertable;
import com.minelittlepony.unicopia.container.SpellbookScreenHandler; import com.minelittlepony.unicopia.container.SpellbookScreenHandler;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -67,7 +68,7 @@ public interface TrinketsDelegate {
} }
default Set<Identifier> getAvailableTrinketSlots(LivingEntity entity, Set<Identifier> probedSlots) { default Set<Identifier> getAvailableTrinketSlots(LivingEntity entity, Set<Identifier> probedSlots) {
return probedSlots.stream().filter(slot -> getEquipped(entity, slot).count() == 0).collect(Collectors.toSet()); return probedSlots.stream().filter(slot -> getEquipped(entity, slot).anyMatch(ItemStack::isEmpty)).collect(Collectors.toSet());
} }
default Stream<ItemStack> getEquipped(LivingEntity entity, Identifier slot) { default Stream<ItemStack> getEquipped(LivingEntity entity, Identifier slot) {

View file

@ -51,11 +51,11 @@ public abstract class WearableItem extends Item implements Equipment {
@Override @Override
public final EquipmentSlot getSlotType() { public final EquipmentSlot getSlotType() {
return EquipmentSlot.OFFHAND; return getSlotType(getDefaultStack());
} }
public EquipmentSlot getSlotType(ItemStack stack) { public EquipmentSlot getSlotType(ItemStack stack) {
return getSlotType(); return EquipmentSlot.OFFHAND;
} }
public static boolean dispenseArmor(BlockPointer pointer, ItemStack armor) { public static boolean dispenseArmor(BlockPointer pointer, ItemStack armor) {