Prevent Spectators from interacting with some create blocks/items (#5414)

- Spectators can no longer interact with Super Glue and Valve Handles
This commit is contained in:
attackeight 2023-09-20 03:57:41 -04:00 committed by GitHub
parent 07883a588d
commit cfee3aff76
Failed to generate hash of commit
2 changed files with 4 additions and 0 deletions

View file

@ -189,6 +189,8 @@ public class SuperGlueSelectionHandler {
if (!isGlue(player.getMainHandItem())) if (!isGlue(player.getMainHandItem()))
return false; return false;
if(!player.mayBuild())
return false;
if (attack) { if (attack) {
if (selected == null) if (selected == null)

View file

@ -64,6 +64,8 @@ public class ValveHandleBlock extends HandCrankBlock {
if (!(blockState.getBlock() instanceof ValveHandleBlock vhb)) if (!(blockState.getBlock() instanceof ValveHandleBlock vhb))
return; return;
if (!player.mayBuild())
return;
if (AllItems.WRENCH.isIn(player.getItemInHand(event.getHand())) && player.isSteppingCarefully()) if (AllItems.WRENCH.isIn(player.getItemInHand(event.getHand())) && player.isSteppingCarefully())
return; return;