diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 325696e..84a181d 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -3003,7 +3003,39 @@ public class DankersSkyblockMod if (!Utils.inSkyblock || Minecraft.getMinecraft().thePlayer != event.entityPlayer) return; ItemStack item = event.entityPlayer.getHeldItem(); if (item == null) return; - Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + + if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) { + + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + + if (ToggleCommand.blockBreakingFarmsToggled) { + ArrayList<Item> tools = new ArrayList<>(Arrays.asList( + Items.wooden_hoe, + Items.stone_hoe, + Items.iron_hoe, + Items.golden_hoe, + Items.diamond_hoe, + Items.wooden_axe, + Items.stone_axe, + Items.iron_axe, + Items.golden_axe, + Items.diamond_axe + )); + + ArrayList<Block> farmBlocks = new ArrayList<>(Arrays.asList( + Blocks.dirt, + Blocks.farmland, + Blocks.carpet, + Blocks.glowstone, + Blocks.sea_lantern + )); + + if (tools.contains(item.getItem()) && farmBlocks.contains(block)) { + event.setCanceled(true); + } + + } + } if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) { @@ -3038,7 +3070,9 @@ public class DankersSkyblockMod } } - else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { + Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock(); + ArrayList<Block> interactables = new ArrayList<>(Arrays.asList( Blocks.acacia_door, Blocks.anvil, @@ -3102,37 +3136,6 @@ public class DankersSkyblockMod } } } - - else if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) { - if (ToggleCommand.blockBreakingFarmsToggled) { - ArrayList tools = new ArrayList(Arrays.asList( - Items.wooden_hoe, - Items.stone_hoe, - Items.iron_hoe, - Items.golden_hoe, - Items.diamond_hoe, - Items.wooden_axe, - Items.stone_axe, - Items.iron_axe, - Items.golden_axe, - Items.diamond_axe - )); - - ArrayList farmBlocks = new ArrayList(Arrays.asList( - Blocks.dirt, - Blocks.farmland, - Blocks.carpet, - Blocks.glowstone, - Blocks.sea_lantern - )); - - if (tools.contains(item) && farmBlocks.contains(block)) { - event.setCanceled(true); - } - - } - } - } @SubscribeEvent |