mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fixed players being unable to equip items with binding curse from trinket slots in creative mode
https://github.com/emilyploszaj/trinkets/issues/237
This commit is contained in:
parent
a163686b3a
commit
112dd25d71
1 changed files with 7 additions and 0 deletions
|
@ -7,11 +7,13 @@ import com.minelittlepony.unicopia.item.FriendshipBraceletItem;
|
|||
import com.minelittlepony.unicopia.item.WearableItem;
|
||||
|
||||
import dev.emi.trinkets.api.*;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.predicate.entity.EntityPredicates;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
|
||||
public class UnicopiaTrinket implements Trinket {
|
||||
|
@ -49,6 +51,11 @@ public class UnicopiaTrinket implements Trinket {
|
|||
return slot.inventory().getStack(slot.index()).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUnequip(ItemStack stack, SlotReference slot, LivingEntity entity) {
|
||||
return !(EnchantmentHelper.hasBindingCurse(stack) && EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR.test(entity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(ItemStack stack, SlotReference slot, LivingEntity entity) {
|
||||
item.inventoryTick(stack, entity.world, entity, slot.index(), false);
|
||||
|
|
Loading…
Reference in a new issue