aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2020-12-19 20:19:31 -0500
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2020-12-19 20:19:31 -0500
commit0fad92f9a890f74f2a1c7b0a792325a641f5d322 (patch)
tree7826919f12e17500c24a3ba9326194d3b4e435e8 /src
parentdbef82994f3e437a2e674fb34f5e989944f53290 (diff)
downloadSkyblockMod-0fad92f9a890f74f2a1c7b0a792325a641f5d322.tar.gz
SkyblockMod-0fad92f9a890f74f2a1c7b0a792325a641f5d322.tar.bz2
SkyblockMod-0fad92f9a890f74f2a1c7b0a792325a641f5d322.zip
Fixed prevent breaking farms
Could be improved with a mixin
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java69
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