diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-03-20 22:42:22 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2022-03-20 22:42:22 -0400 |
commit | 71f48e9cf2f250a2ddf5444ccce5d0ebd6487e4a (patch) | |
tree | abc0d0dcb9ea2537b3e01d33f4657b969af79239 /src/main/java | |
parent | 165844ad2624dcdff4517b94f300329cf3a3bf70 (diff) | |
download | SkyblockMod-71f48e9cf2f250a2ddf5444ccce5d0ebd6487e4a.tar.gz SkyblockMod-71f48e9cf2f250a2ddf5444ccce5d0ebd6487e4a.tar.bz2 SkyblockMod-71f48e9cf2f250a2ddf5444ccce5d0ebd6487e4a.zip |
Add hiding player armour
Diffstat (limited to 'src/main/java')
5 files changed, 62 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 02eeff4..353247d 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -131,6 +131,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new GolemSpawningAlert()); MinecraftForge.EVENT_BUS.register(new GpartyNotifications()); MinecraftForge.EVENT_BUS.register(new HidePetCandy()); + MinecraftForge.EVENT_BUS.register(new HidePlayerArmour()); MinecraftForge.EVENT_BUS.register(new HideTooltipsInExperiments()); MinecraftForge.EVENT_BUS.register(new HighlightSkeletonMasters()); MinecraftForge.EVENT_BUS.register(new IceWalkSolver()); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 04770aa..2281a0a 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -48,6 +48,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean abilityCooldowns; public static boolean alerts; public static boolean dungeonScore; + public static boolean hideArmour; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; diff --git a/src/main/java/me/Danker/features/HidePlayerArmour.java b/src/main/java/me/Danker/features/HidePlayerArmour.java new file mode 100644 index 0000000..8cc47d0 --- /dev/null +++ b/src/main/java/me/Danker/features/HidePlayerArmour.java @@ -0,0 +1,51 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.List; + +public class HidePlayerArmour { + + List<ItemStack> armour = new ArrayList<>(); + + @SubscribeEvent + public void onRenderLivingPre(RenderLivingEvent.Pre<EntityLivingBase> event) { + if (ToggleCommand.hideArmour && Utils.inSkyblock) { + if (event.entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.entity; + + for (int i = 0; i < player.inventory.armorInventory.length; i++) { + if (player.inventory.armorInventory[i] != null) { + armour.add(player.inventory.armorInventory[i].copy()); + player.inventory.armorInventory[i] = null; + } else { + armour.add(null); + } + } + } + } + } + + @SubscribeEvent + public void onRenderLivingPost(RenderLivingEvent.Post<EntityLivingBase> event) { + if (ToggleCommand.hideArmour && Utils.inSkyblock) { + if (event.entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.entity; + + for (int i = 0; i < player.inventory.armorInventory.length; i++) { + player.inventory.armorInventory[i] = armour.get(i); + } + + armour.clear(); + } + } + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index a6f76b1..fb84b0a 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -1,5 +1,6 @@ package me.Danker.gui; +import jdk.nashorn.internal.runtime.regexp.joni.Config; import me.Danker.commands.ToggleCommand; import me.Danker.gui.alerts.AlertsGui; import me.Danker.gui.buttons.FeatureButton; @@ -85,6 +86,7 @@ public class DankerGui extends GuiScreen { private GuiButton necronNotifications; private GuiButton bonzoTimer; private GuiButton dungeonScore; + private GuiButton hideArmour; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -175,6 +177,7 @@ public class DankerGui extends GuiScreen { autoAcceptReparty = new FeatureButton("Auto Accept Reparty: " + Utils.getColouredBoolean(ToggleCommand.autoAcceptReparty), "Automatically rejoins parties when disbanded and invited."); abilityCooldown = new FeatureButton("Ability Cooldowns: " + Utils.getColouredBoolean(ToggleCommand.abilityCooldowns), "Displays ability cooldowns."); dungeonScore = new FeatureButton("Dungeon Score Display: " + Utils.getColouredBoolean(ToggleCommand.dungeonScore), "Displays an estimated dungeon score with secrets."); + hideArmour = new FeatureButton("Hide Player Armour: " + Utils.getColouredBoolean(ToggleCommand.hideArmour), "Makes player armour invisible, showing their skin."); allButtons.clear(); allButtons.add(changeDisplay); @@ -231,6 +234,7 @@ public class DankerGui extends GuiScreen { allButtons.add(autoAcceptReparty); allButtons.add(abilityCooldown); allButtons.add(dungeonScore); + allButtons.add(hideArmour); search.setText(initSearchText); search.setVisible(true); @@ -510,6 +514,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.masterSPlusDisplay = !ToggleCommand.masterSPlusDisplay; ConfigHandler.writeBooleanConfig("toggles", "MasterSPlusDisplay", ToggleCommand.masterSPlusDisplay); masterSPlusDisplay.displayString = "Display MM S+ Runs: " + Utils.getColouredBoolean(ToggleCommand.masterSPlusDisplay); + } else if (button == hideArmour) { + ToggleCommand.hideArmour = !ToggleCommand.hideArmour; + ConfigHandler.writeBooleanConfig("toggles", "HideArmour", ToggleCommand.hideArmour); + hideArmour.displayString = "Hide Player Armour: " + Utils.getColouredBoolean(ToggleCommand.hideArmour); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index dc57e91..ed28704 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -241,6 +241,7 @@ public class ConfigHandler { ToggleCommand.autoSkillTrackerToggled = initBoolean("toggles", "AutoSkillTracker", false); ToggleCommand.alerts = initBoolean("toggles", "Alerts", false); ToggleCommand.dungeonScore = initBoolean("toggles", "DungeonScore", false); + ToggleCommand.hideArmour = initBoolean("toggles", "HideArmour", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); |