aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/PetColours.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2021-04-08 08:43:19 -0400
committerGitHub <noreply@github.com>2021-04-08 08:43:19 -0400
commit14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe (patch)
tree5b58218f51e6f358e5dd15946580dd7b7159c79a /src/main/java/me/Danker/features/PetColours.java
parent435d8dfd5a7f36803ceefcbd245e814ec735aced (diff)
parent8b1c19bff9ca13034e794ef76086e75aaf59bd14 (diff)
downloadSkyblockMod-14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe.tar.gz
SkyblockMod-14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe.tar.bz2
SkyblockMod-14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe.zip
Merge pull request #91 from bowser0000/developmentv1.8.6
1.8.6
Diffstat (limited to 'src/main/java/me/Danker/features/PetColours.java')
-rw-r--r--src/main/java/me/Danker/features/PetColours.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/PetColours.java b/src/main/java/me/Danker/features/PetColours.java
new file mode 100644
index 0000000..5889b12
--- /dev/null
+++ b/src/main/java/me/Danker/features/PetColours.java
@@ -0,0 +1,69 @@
+package me.Danker.features;
+
+import me.Danker.commands.ToggleCommand;
+import me.Danker.events.GuiChestBackgroundDrawnEvent;
+import me.Danker.utils.Utils;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StringUtils;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+import java.util.regex.Pattern;
+
+public class PetColours {
+
+ static Pattern petPattern = Pattern.compile("\\[Lvl [\\d]{1,3}]");
+ public static int PET_1_TO_9;
+ public static int PET_10_TO_19;
+ public static int PET_20_TO_29;
+ public static int PET_30_TO_39;
+ public static int PET_40_TO_49;
+ public static int PET_50_TO_59;
+ public static int PET_60_TO_69;
+ public static int PET_70_TO_79;
+ public static int PET_80_TO_89;
+ public static int PET_90_TO_99;
+ public static int PET_100;
+
+ @SubscribeEvent
+ public void onGuiRender(GuiChestBackgroundDrawnEvent event) {
+ if (ToggleCommand.petColoursToggled) {
+ for (Slot slot : event.slots) {
+ ItemStack item = slot.getStack();
+ if (item == null) continue;
+ String name = item.getDisplayName();
+ if (petPattern.matcher(StringUtils.stripControlCodes(name)).find()) {
+ if (name.endsWith("aHealer") || name.endsWith("aMage") || name.endsWith("aBerserk") || name.endsWith("aArcher") || name.endsWith("aTank"))
+ continue;
+ int colour;
+ int petLevel = Integer.parseInt(item.getDisplayName().substring(item.getDisplayName().indexOf(" ") + 1, item.getDisplayName().indexOf("]")));
+ if (petLevel == 100) {
+ colour = PET_100;
+ } else if (petLevel >= 90) {
+ colour = PET_90_TO_99;
+ } else if (petLevel >= 80) {
+ colour = PET_80_TO_89;
+ } else if (petLevel >= 70) {
+ colour = PET_70_TO_79;
+ } else if (petLevel >= 60) {
+ colour = PET_60_TO_69;
+ } else if (petLevel >= 50) {
+ colour = PET_50_TO_59;
+ } else if (petLevel >= 40) {
+ colour = PET_40_TO_49;
+ } else if (petLevel >= 30) {
+ colour = PET_30_TO_39;
+ } else if (petLevel >= 20) {
+ colour = PET_20_TO_29;
+ } else if (petLevel >= 10) {
+ colour = PET_10_TO_19;
+ } else {
+ colour = PET_1_TO_9;
+ }
+ Utils.drawOnSlot(event.chestSize, slot.xDisplayPosition, slot.yDisplayPosition, colour + 0xBF000000);
+ }
+ }
+ }
+ }
+
+}