trinkets icon indicating copy to clipboard operation
trinkets copied to clipboard

Creative players cannot unequip items with curse of binding from trinket slots

Open Sollace opened this issue 1 year ago • 0 comments

The normal behaviour in vanilla is that players in creative mode can still unequip armour even when it has curse of binding.

It seems to be an oversight in Trinket#canUnequip where the method does not check if the wearer is a creative mode player.

	/**
	 * Determines whether an entity can unequip a trinket
	 *
	 * @param stack The stack being unequipped
	 * @param slot The slot the stack is being unequipped from
	 * @param entity The entity that is unequipping the stack
	 * @return Whether the stack can be unequipped
	 */
	default boolean canUnequip(ItemStack stack, SlotReference slot, LivingEntity entity) {
		return !EnchantmentHelper.hasBindingCurse(stack);
	}

This is the fix I'm implementing in my subclass:

    @Override
    public boolean canUnequip(ItemStack stack, SlotReference slot, LivingEntity entity) {
        return !(EnchantmentHelper.hasBindingCurse(stack) && EntityPredicates.EXCEPT_CREATIVE_OR_SPECTATOR.test(entity));
    }

And a reference to vanilla to show that this is the intended behaviour:

image

Sollace avatar Mar 17 '23 19:03 Sollace