From d1497abd1e16ada4812c6c077db2aa6f9973cbcf Mon Sep 17 00:00:00 2001 From: abel1502 Date: Sun, 29 Jun 2025 23:40:51 +0300 Subject: [PATCH] Simplify press click handling Turns out there is already a function for doing just that --- .../com/hbm/blocks/machine/MachineEPress.java | 17 +---------------- .../com/hbm/blocks/machine/MachinePress.java | 17 +---------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/hbm/blocks/machine/MachineEPress.java b/src/main/java/com/hbm/blocks/machine/MachineEPress.java index add331ba3..c44a8e575 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineEPress.java +++ b/src/main/java/com/hbm/blocks/machine/MachineEPress.java @@ -59,21 +59,6 @@ public class MachineEPress extends BlockDummyable { @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) { - return true; - } else if(!player.isSneaking()) { - int[] pos = this.findCore(world, x, y, z); - if(pos == null) - return false; - - TileEntityMachineEPress entity = (TileEntityMachineEPress) world.getTileEntity(pos[0], pos[1], pos[2]); - if(entity == null) - return false; - - FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]); - return true; - } else { - return false; - } + return this.standardOpenBehavior(world, x, y, z, player, 0); } } \ No newline at end of file diff --git a/src/main/java/com/hbm/blocks/machine/MachinePress.java b/src/main/java/com/hbm/blocks/machine/MachinePress.java index 6f4cf5808..1e6c51ca3 100644 --- a/src/main/java/com/hbm/blocks/machine/MachinePress.java +++ b/src/main/java/com/hbm/blocks/machine/MachinePress.java @@ -43,21 +43,6 @@ public class MachinePress extends BlockDummyable { @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) { - return true; - } else if(!player.isSneaking()) { - int[] pos = this.findCore(world, x, y, z); - if(pos == null) - return false; - - TileEntityMachinePress entity = (TileEntityMachinePress) world.getTileEntity(pos[0], pos[1], pos[2]); - if(entity == null) - return false; - - FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]); - return true; - } else { - return false; - } + return this.standardOpenBehavior(world, x, y, z, player, 0); } }