craftycorvid / ImprovedSigns

Improvements for your signs and frames on your Fabric/Quilt server
MIT License
11 stars 4 forks source link

Shift clicking with a nonempty hand opens the edit screen #11

Closed slemal closed 3 years ago

slemal commented 3 years ago

In vanilla, the only way to interact with an item while holding shift if with an empty hand. For example, shift clicking a chest with an empty hand opens the chest but shift clicking it with a frame in hand places the frame.

I think it would be more consistent if signs behaved in a similar manner. Shift clicking a sign should open the edit screen only if the player's hand is empty. Otherwise, it should just use the item.

A fix would be changing the following function.

    boolean isNotHoldingSign(PlayerEntity player) {
        Item mainHandItem = player.getEquippedStack(EquipmentSlot.MAINHAND).getItem();
        Item offHandItem = player.getEquippedStack(EquipmentSlot.OFFHAND).getItem();
        return !(mainHandItem instanceof SignItem || offHandItem instanceof SignItem);
    } 

On vanilla minecraft, the player has to have both hand empty in order to interact with a block with holding shift. This might be a little too restrictive in our case. I think the best would be to check for empty main hand and !(offHandItem instanceof BlockItem).

slemal commented 3 years ago

Is solved by pull request #12.