aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-08-25 00:18:42 -0400
committerbowser0000 <bowser0000@gmail.com>2020-08-25 00:18:42 -0400
commitece7f3de65618ee89f86513e4d8307a97c20f012 (patch)
tree992cdb04e51d996ca9cec2a0aecc7ecf7e7361c2 /src/main/java/me
parent4c11aaf6d16940fb02cf14fb97bb76477912dd8f (diff)
downloadSkyblockMod-ece7f3de65618ee89f86513e4d8307a97c20f012.tar.gz
SkyblockMod-ece7f3de65618ee89f86513e4d8307a97c20f012.tar.bz2
SkyblockMod-ece7f3de65618ee89f86513e4d8307a97c20f012.zip
Add pet background (temporary) colours and fix Jerry Workshop /sbplayers
Colours are temporary, will be changed in a future commit.
Diffstat (limited to 'src/main/java/me')
-rw-r--r--src/main/java/me/Danker/TheMod.java50
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java2
-rw-r--r--src/main/java/me/Danker/commands/SkyblockPlayersCommand.java7
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java16
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java2
-rw-r--r--src/main/java/me/Danker/utils/Utils.java18
6 files changed, 84 insertions, 11 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java
index ae6a810..7fc7d92 100644
--- a/src/main/java/me/Danker/TheMod.java
+++ b/src/main/java/me/Danker/TheMod.java
@@ -41,23 +41,27 @@ import me.Danker.handlers.TextRenderer;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.ClickEvent.Action;
+import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
-import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
@@ -1317,6 +1321,7 @@ public class TheMod
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onSound(final PlaySoundEvent event) {
+ if (!Utils.inSkyblock) return;
if (event.name.equals("note.pling")) {
// Don't check twice within 3 seconds
checkItemsNow = System.currentTimeMillis() / 1000;
@@ -1369,6 +1374,7 @@ public class TheMod
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onTooltip(ItemTooltipEvent event) {
+ if (!Utils.inSkyblock) return;
final ToggleCommand tc = new ToggleCommand();
if (event.toolTip == null) return;
@@ -1412,11 +1418,53 @@ public class TheMod
@SubscribeEvent
public void onKey(KeyInputEvent event) {
+ if (!Utils.inSkyblock) return;
if (keyBindings[0].isPressed()) {
Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand);
}
}
+ @SubscribeEvent
+ public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent event) {
+ if (!Utils.inSkyblock) return;
+ if (ToggleCommand.petColoursToggled && event.gui instanceof GuiChest) {
+ GuiChest inventory = (GuiChest) event.gui;
+ List<Slot> invSlots = inventory.inventorySlots.inventorySlots;
+ for (Slot slot : invSlots) {
+ ItemStack item = slot.getStack();
+ if (item == null) continue;
+ if (item.getDisplayName().contains("[Lvl ")) {
+ int colour;
+ int petLevel = Integer.parseInt(item.getDisplayName().substring(item.getDisplayName().indexOf(" ") + 1, item.getDisplayName().indexOf("]")));
+ if (petLevel == 100) {
+ colour = 0xBFF2D249; // Gold
+ } else if (petLevel >= 90) {
+ colour = 0xBFE06C65; // Red
+ } else if (petLevel >= 80) {
+ colour = 0xBF5F91C0; // Blue
+ } else if (petLevel >= 70) {
+ colour = 0xBF84CA85; // Green
+ } else if (petLevel >= 60) {
+ colour = 0xBFF6C100; // Goldish
+ } else if (petLevel >= 50) {
+ colour = 0xBFA575D2; // Purple
+ } else if (petLevel >= 40) {
+ colour = 0xBFFFA252; // Orange
+ } else if (petLevel >= 30) {
+ colour = 0xBF845EF7; // Bluish purple
+ } else if (petLevel >= 20) {
+ colour = 0xBFD6336C; // Magenta
+ } else if (petLevel >= 10) {
+ colour = 0xBF58C9A3; // Teal
+ } else {
+ colour = 0xBFFEBBD1; // Pink
+ }
+ Utils.drawOnSlot(slot.xDisplayPosition, slot.yDisplayPosition, colour);
+ }
+ }
+ }
+ }
+
public void increaseEmpSC() {
LootCommand lc = new LootCommand();
ConfigHandler cf = new ConfigHandler();
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
index 976e469..4b92137 100644
--- a/src/main/java/me/Danker/commands/DHelpCommand.java
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -33,7 +33,7 @@ public class DHelpCommand extends CommandBase {
EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" +
EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" +
EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" +
- EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/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/sceptremessages/petcolors/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> [winter/f(1-4)/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/SkyblockPlayersCommand.java b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java
index 98afa28..ee3c522 100644
--- a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java
+++ b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java
@@ -78,7 +78,7 @@ public class SkyblockPlayersCommand extends CommandBase {
int dungeonsHub = 0; // dungeon_hub
int dungeons = 0; // dungeon
int darkAuction = 0; // dark_auction
- int jerry = 0;
+ int jerry = 0; // winter
if (playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().has("modes")) {
JsonObject skyblockPlayers = playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().get("modes").getAsJsonObject();
skyblockTotalPlayers = playersResponse.get("games").getAsJsonObject().get("SKYBLOCK").getAsJsonObject().get("players").getAsInt();
@@ -121,9 +121,8 @@ public class SkyblockPlayersCommand extends CommandBase {
if (skyblockPlayers.has("dark_auction")) {
darkAuction = skyblockPlayers.get("dark_auction").getAsInt();
}
- // Placeholder value until Jerry Workshop opens
- if (skyblockPlayers.has("jerry")) {
- jerry = skyblockPlayers.get("jerry").getAsInt();
+ if (skyblockPlayers.has("winter")) {
+ jerry = skyblockPlayers.get("winter").getAsInt();
}
}
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 1e07f3a..5c37b83 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -23,6 +23,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
public static boolean spiritBearAlerts;
public static boolean aotdToggled;
public static boolean sceptreMessages;
+ public static boolean petColoursToggled;
@Override
public String getCommandName() {
@@ -31,7 +32,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
@Override
public String getCommandUsage(ICommandSender arg0) {
- return getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalert/aotd/sceptremessages/list>";
+ return getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalert/aotd/sceptremessages/petcolors/list>";
}
@Override
@@ -42,7 +43,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
if (args.length == 1) {
- return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "list");
+ return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "sceptremessages", "petcolors", "list");
}
return null;
}
@@ -53,7 +54,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
final ConfigHandler cf = new ConfigHandler();
if (arg1.length == 0) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/list>"));
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/list>"));
return;
}
@@ -97,6 +98,10 @@ public class ToggleCommand extends CommandBase implements ICommand {
sceptreMessages = !sceptreMessages;
cf.writeBooleanConfig("toggles", "SceptreMessages", sceptreMessages);
player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Spirit Sceptre messages have been set to " + EnumChatFormatting.DARK_GREEN + sceptreMessages + EnumChatFormatting.GREEN + "."));
+ } else if (arg1[0].equalsIgnoreCase("petcolors") || arg1[0].equalsIgnoreCase("petcolours")) {
+ petColoursToggled = !petColoursToggled;
+ cf.writeBooleanConfig("toggles", "PetColors", petColoursToggled);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Pet colours have been set to " + EnumChatFormatting.DARK_GREEN + petColoursToggled + EnumChatFormatting.GREEN + "."));
} else if (arg1[0].equalsIgnoreCase("list")) {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" +
EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled + "\n" +
@@ -107,9 +112,10 @@ public class ToggleCommand extends CommandBase implements ICommand {
EnumChatFormatting.GREEN + " Chat Maddox menu: " + EnumChatFormatting.DARK_GREEN + chatMaddoxToggled + "\n" +
EnumChatFormatting.GREEN + " Spirit Bear alerts: " + EnumChatFormatting.DARK_GREEN + spiritBearAlerts + "\n" +
EnumChatFormatting.GREEN + " Block AOTD ability: " + EnumChatFormatting.DARK_GREEN + aotdToggled + "\n" +
- EnumChatFormatting.GREEN + " Spirit Sceptre messages: " + EnumChatFormatting.DARK_GREEN + sceptreMessages));
+ EnumChatFormatting.GREEN + " Spirit Sceptre messages: " + EnumChatFormatting.DARK_GREEN + sceptreMessages + "\n" +
+ EnumChatFormatting.GREEN + " Pet colours: " + EnumChatFormatting.DARK_GREEN + petColoursToggled));
} else {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/list>"));
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/sceptremessages/petcolors/list>"));
}
}
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 2c6f48d..aa6f5ba 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -179,6 +179,7 @@ public class ConfigHandler {
if (!hasKey("toggles", "SpiritBearAlerts")) writeBooleanConfig("toggles", "SpiritBearAlerts", true);
if (!hasKey("toggles", "AOTD")) writeBooleanConfig("toggles", "AOTD", false);
if (!hasKey("toggles", "SceptreMessages")) writeBooleanConfig("toggles", "SceptreMessages", true);
+ if (!hasKey("toggles", "PetColors")) writeBooleanConfig("toggles", "PetColors", false);
if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", "");
@@ -294,6 +295,7 @@ public class ConfigHandler {
tf.spiritBearAlerts = getBoolean("toggles", "SpiritBearAlerts");
tf.aotdToggled = getBoolean("toggles", "AOTD");
tf.sceptreMessages = getBoolean("toggles", "SceptreMessages");
+ tf.petColoursToggled = getBoolean("toggles", "PetColors");
final LootCommand lc = new LootCommand();
// Wolf
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
index 7153014..16f790a 100644
--- a/src/main/java/me/Danker/utils/Utils.java
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -4,13 +4,19 @@ import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
+import org.lwjgl.opengl.GL11;
+
import me.Danker.TheMod;
import me.Danker.handlers.ScoreboardHandler;
import me.Danker.handlers.TextRenderer;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.StringUtils;
@@ -120,4 +126,16 @@ public class Utils {
return result;
}
+ public static void drawOnSlot(int xSlotPos, int ySlotPos, int colour) {
+ ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
+ int guiLeft = (sr.getScaledWidth() - 176) / 2;
+ int guiTop = (sr.getScaledHeight() - 221) / 2;
+ int x = guiLeft + xSlotPos;
+ int y = guiTop + ySlotPos;
+
+ GL11.glTranslated(0, 0, 1);
+ Gui.drawRect(x, y, x + 16, y + 16, colour);
+ GL11.glTranslated(0, 0, -1);
+ }
+
}