aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2020-12-19 11:22:32 -0500
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2020-12-19 11:22:32 -0500
commit6143fa32651bebd85afa46d8f8a4eeaea9fee595 (patch)
treebda789abb3fc4dad9506ef18b18f11617734f2fe /src/main/java/me
parent5805888e0c1dea9602122595cf74b35bf90d696d (diff)
downloadSkyblockMod-6143fa32651bebd85afa46d8f8a4eeaea9fee595.tar.gz
SkyblockMod-6143fa32651bebd85afa46d8f8a4eeaea9fee595.tar.bz2
SkyblockMod-6143fa32651bebd85afa46d8f8a4eeaea9fee595.zip
Feat: Prevent Breaking Farms
Diffstat (limited to 'src/main/java/me')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java37
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java2
-rw-r--r--src/main/java/me/Danker/commands/DankerGuiCommand.java1
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java11
-rw-r--r--src/main/java/me/Danker/gui/DankerGui.java14
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java2
6 files changed, 60 insertions, 7 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 2035784..da82fdb 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -3003,8 +3003,9 @@ 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.RIGHT_CLICK_AIR) {
+ if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) {
if (ToggleCommand.aotdToggled && item.getDisplayName().contains("Aspect of the Dragons")) {
event.setCanceled(true);
}
@@ -3037,8 +3038,7 @@ public class DankersSkyblockMod
}
}
- if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
- Block block = Minecraft.getMinecraft().theWorld.getBlockState(event.pos).getBlock();
+ else if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
ArrayList<Block> interactables = new ArrayList<>(Arrays.asList(
Blocks.acacia_door,
Blocks.anvil,
@@ -3102,6 +3102,37 @@ 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
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
index a9632b9..699374d 100644
--- a/src/main/java/me/Danker/commands/DHelpCommand.java
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase {
EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" +
EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" +
EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" +
- EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/flowerweapons/sceptremessages/midasstaffmessages/implosionmessages/healmessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
+ EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/flowerweapons/sceptremessages/midasstaffmessages/implosionmessages/healmessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/necronnotifications/bonzotimer/blockbreakingfarms/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" +
EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" +
EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing/catacombs/mythological/> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" +
diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java
index 3e599f5..dea6859 100644
--- a/src/main/java/me/Danker/commands/DankerGuiCommand.java
+++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java
@@ -62,6 +62,7 @@ public class DankerGuiCommand extends CommandBase {
debug.append("[notifyslayerslain][").append(ToggleCommand.notifySlayerSlainToggled).append("]\n");
debug.append("[necronnotifications][").append(ToggleCommand.necronNotificationsToggled).append("]\n");
debug.append("[bonzotimer][").append(ToggleCommand.bonzoTimerToggled).append("]\n");
+ debug.append("[blockbreakingfarms][").append(ToggleCommand.blockBreakingFarmsToggled).append("]\n");
debug.append("[threemanpuzzle][").append(ToggleCommand.threeManToggled).append("]\n");
debug.append("[oruopuzzle][").append(ToggleCommand.oruoToggled).append("]\n");
debug.append("[blazepuzzle][").append(ToggleCommand.blazeToggled).append("]\n");
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 2b9bbd7..81e3f9c 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -43,6 +43,8 @@ public class ToggleCommand extends CommandBase implements ICommand {
public static boolean notifySlayerSlainToggled;
public static boolean necronNotificationsToggled;
public static boolean bonzoTimerToggled;
+ public static boolean blockBreakingFarmsToggled;
+
// Puzzle Solvers
public static boolean threeManToggled;
public static boolean oruoToggled;
@@ -72,7 +74,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
return "/" + getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalert/" +
"aotd/lividdagger/flowerweapons/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" +
"outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" +
- "lividsolver/stopsalvagestarred/notifyslayerslain/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" +
+ "lividsolver/stopsalvagestarred/notifyslayerslain/necronnotifications/bonzotimer/blockbreakingfarms/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" +
"watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/" +
"itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>";
}
@@ -90,7 +92,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts",
"expertiselore", "skill50display", "outlinetext", "midasstaffmessages",
"implosionmessages", "healmessages", "caketimer", "lowhealthnotify",
- "lividsolver", "stopsalvagestarred", "notifyslayerslain", "necronnotifications", "bonzotimer", "threemanpuzzle", "oruopuzzle", "blazepuzzle",
+ "lividsolver", "stopsalvagestarred", "notifyslayerslain", "necronnotifications", "bonzotimer", "blockbreakingfarms", "threemanpuzzle", "oruopuzzle", "blazepuzzle",
"creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal",
"selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer",
"chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list");
@@ -249,6 +251,11 @@ public class ToggleCommand extends CommandBase implements ICommand {
ConfigHandler.writeBooleanConfig("toggles", "BonzoTimer", bonzoTimerToggled);
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Bonzo's Mask timer has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + necronNotificationsToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
break;
+ case "blockbreakingfarms":
+ blockBreakingFarmsToggled = !blockBreakingFarmsToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "BlockBreakingFarms", blockBreakingFarmsToggled);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Prevent breaking farms has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + necronNotificationsToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
+ break;
case "threemanpuzzle":
threeManToggled = !threeManToggled;
ConfigHandler.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled);
diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java
index 03937a8..2860997 100644
--- a/src/main/java/me/Danker/gui/DankerGui.java
+++ b/src/main/java/me/Danker/gui/DankerGui.java
@@ -60,6 +60,7 @@ public class DankerGui extends GuiScreen {
private GuiButton notifySlayerSlain;
private GuiButton necronNotifications;
private GuiButton bonzoTimer;
+ private GuiButton blockBreakingFarms;
public DankerGui(int page) {
this.page = page;
@@ -125,6 +126,8 @@ public class DankerGui extends GuiScreen {
flowerWeapons = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled));
necronNotifications = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled));
bonzoTimer = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled));
+ //Page 6
+ blockBreakingFarms = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Prevent Breaking Farms: " + Utils.getColouredBoolean(ToggleCommand.blockBreakingFarmsToggled));
switch (page) {
case 1:
@@ -178,6 +181,11 @@ public class DankerGui extends GuiScreen {
this.buttonList.add(flowerWeapons);
this.buttonList.add(necronNotifications);
this.buttonList.add(bonzoTimer);
+ this.buttonList.add(nextPage);
+ this.buttonList.add(backPage);
+ break;
+ case 6:
+ this.buttonList.add(blockBreakingFarms);
this.buttonList.add(backPage);
break;
}
@@ -190,7 +198,7 @@ public class DankerGui extends GuiScreen {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
- String pageText = "Page: " + page + "/5";
+ String pageText = "Page: " + page + "/6";
int pageWidth = mc.fontRendererObj.getStringWidth(pageText);
new TextRenderer(mc, pageText, width / 2 - pageWidth / 2, 10, 1D);
super.drawScreen(mouseX, mouseY, partialTicks);
@@ -338,6 +346,10 @@ public class DankerGui extends GuiScreen {
ToggleCommand.bonzoTimerToggled = !ToggleCommand.bonzoTimerToggled;
ConfigHandler.writeBooleanConfig("toggles", "BonzoTimer", ToggleCommand.bonzoTimerToggled);
bonzoTimer.displayString = "Bonzo's Mask Timer: " + Utils.getColouredBoolean(ToggleCommand.bonzoTimerToggled);
+ } else if (button == blockBreakingFarms) {
+ ToggleCommand.blockBreakingFarmsToggled = !ToggleCommand.blockBreakingFarmsToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "BlockBreakingFarms", ToggleCommand.blockBreakingFarmsToggled);
+ blockBreakingFarms.displayString = "Prevent Breaking Farms: " + Utils.getColouredBoolean(ToggleCommand.blockBreakingFarmsToggled);
} else if (button == pickBlock) {
ToggleCommand.swapToPickBlockToggled = !ToggleCommand.swapToPickBlockToggled;
ConfigHandler.writeBooleanConfig("toggles", "PickBlock", ToggleCommand.swapToPickBlockToggled);
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 2822738..3d1855e 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -198,6 +198,7 @@ public class ConfigHandler {
if (!hasKey("toggles", "NotifySlayerSlain")) writeBooleanConfig("toggles", "NotifySlayerSlain", false);
if (!hasKey("toggles", "NecronNotifications")) writeBooleanConfig("toggles", "NecronNotifications", false);
if (!hasKey("toggles", "BonzoTimer")) writeBooleanConfig("toggles", "BonzoTimer", false);
+ if (!hasKey("toggles", "BlockBreakingFarms")) writeBooleanConfig("toggles", "BlockBreakingFarms", true);
// Puzzle Solvers
@@ -475,6 +476,7 @@ public class ConfigHandler {
ToggleCommand.notifySlayerSlainToggled = getBoolean("toggles", "NotifySlayerSlain");
ToggleCommand.necronNotificationsToggled = getBoolean("toggles", "NecronNotifications");
ToggleCommand.bonzoTimerToggled = getBoolean("toggles", "BonzoTimer");
+ ToggleCommand.blockBreakingFarmsToggled = getBoolean("toggles", "BlockBreakingFarms");
ToggleCommand.swapToPickBlockToggled = getBoolean("toggles", "PickBlock");
ToggleCommand.flowerWeaponsToggled = getBoolean("toggles", "FlowerWeapons");