aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2022-03-04 20:26:29 -0500
committerbowser0000 <bowser0000@gmail.com>2022-03-04 20:26:29 -0500
commit4a9c72be2c81059569f6cf75e854b9cdefc2891a (patch)
tree567cffed66a753d41598a3ccdfafc1bf961f3a66 /src/main
parent2b57ccad6d21b325c3164117fe14e00e13399a7c (diff)
downloadSkyblockMod-4a9c72be2c81059569f6cf75e854b9cdefc2891a.tar.gz
SkyblockMod-4a9c72be2c81059569f6cf75e854b9cdefc2891a.tar.bz2
SkyblockMod-4a9c72be2c81059569f6cf75e854b9cdefc2891a.zip
Add custom colours to titles
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java1
-rw-r--r--src/main/java/me/Danker/commands/CustomMusicCommand.java3
-rw-r--r--src/main/java/me/Danker/commands/InventoryCommand.java1
-rw-r--r--src/main/java/me/Danker/features/AbilityCooldowns.java1
-rw-r--r--src/main/java/me/Danker/features/ColouredNames.java31
-rw-r--r--src/main/java/me/Danker/features/DungeonScore.java2
-rw-r--r--src/main/java/me/Danker/gui/CustomMusicGui.java1
-rw-r--r--src/main/java/me/Danker/gui/DankerGui.java2
-rw-r--r--src/main/java/me/Danker/gui/DisplayGui.java2
-rw-r--r--src/main/java/me/Danker/gui/ExperimentsGui.java1
-rw-r--r--src/main/java/me/Danker/gui/OnlySlayerGui.java4
-rw-r--r--src/main/java/me/Danker/gui/PuzzleSolversGui.java1
-rw-r--r--src/main/java/me/Danker/gui/SkillTrackerGui.java2
-rw-r--r--src/main/java/me/Danker/gui/WarningGui.java1
-rw-r--r--src/main/java/me/Danker/gui/alerts/AlertAddGui.java3
-rw-r--r--src/main/java/me/Danker/gui/alerts/AlertsGui.java1
-rw-r--r--src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java1
-rw-r--r--src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java2
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java6
-rw-r--r--src/main/java/me/Danker/utils/Utils.java1
20 files changed, 35 insertions, 32 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 0d7e577..ce39152 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -9,7 +9,6 @@ import me.Danker.features.*;
import me.Danker.features.loot.*;
import me.Danker.features.puzzlesolvers.*;
import me.Danker.gui.*;
-import me.Danker.gui.crystalhollowwaypoints.CrystalHollowWaypointsGui;
import me.Danker.handlers.ConfigHandler;
import me.Danker.handlers.PacketHandler;
import me.Danker.utils.RenderUtils;
diff --git a/src/main/java/me/Danker/commands/CustomMusicCommand.java b/src/main/java/me/Danker/commands/CustomMusicCommand.java
index d21d08e..283b748 100644
--- a/src/main/java/me/Danker/commands/CustomMusicCommand.java
+++ b/src/main/java/me/Danker/commands/CustomMusicCommand.java
@@ -10,9 +10,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
-import javax.sound.sampled.LineUnavailableException;
-import javax.sound.sampled.UnsupportedAudioFileException;
-import java.io.IOException;
import java.util.List;
public class CustomMusicCommand extends CommandBase {
diff --git a/src/main/java/me/Danker/commands/InventoryCommand.java b/src/main/java/me/Danker/commands/InventoryCommand.java
index d4b35ae..66a5725 100644
--- a/src/main/java/me/Danker/commands/InventoryCommand.java
+++ b/src/main/java/me/Danker/commands/InventoryCommand.java
@@ -12,7 +12,6 @@ import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryBasic;
import net.minecraft.item.ItemStack;
diff --git a/src/main/java/me/Danker/features/AbilityCooldowns.java b/src/main/java/me/Danker/features/AbilityCooldowns.java
index 397857a..e98660e 100644
--- a/src/main/java/me/Danker/features/AbilityCooldowns.java
+++ b/src/main/java/me/Danker/features/AbilityCooldowns.java
@@ -12,7 +12,6 @@ import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StringUtils;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
diff --git a/src/main/java/me/Danker/features/ColouredNames.java b/src/main/java/me/Danker/features/ColouredNames.java
index f7f4d7a..aad1ab1 100644
--- a/src/main/java/me/Danker/features/ColouredNames.java
+++ b/src/main/java/me/Danker/features/ColouredNames.java
@@ -2,10 +2,12 @@ package me.Danker.features;
import me.Danker.DankersSkyblockMod;
import me.Danker.commands.ToggleCommand;
+import me.Danker.events.PacketReadEvent;
import me.Danker.utils.Utils;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.network.play.server.S45PacketTitle;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
@@ -16,7 +18,9 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.relauncher.ReflectionHelper;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -30,6 +34,8 @@ public class ColouredNames {
public static Map<String, String> nametags = new HashMap<>();
public static final EnumChatFormatting[] RAINBOW_COLOURS = new EnumChatFormatting[]{EnumChatFormatting.RED, EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.GREEN, EnumChatFormatting.AQUA, EnumChatFormatting.BLUE, EnumChatFormatting.DARK_PURPLE};
+ static Field messageField = ReflectionHelper.findField(S45PacketTitle.class, "message", "field_179810_b", "b");
+
@SubscribeEvent
public void onChat(ClientChatReceivedEvent event) {
if (!ToggleCommand.customColouredNames || !Utils.inSkyblock || event.type != 0) return;
@@ -91,6 +97,31 @@ public class ColouredNames {
}
@SubscribeEvent
+ public void onPacketRead(PacketReadEvent event) {
+ if (!ToggleCommand.customColouredNames || !Utils.inSkyblock) return;
+
+ if (event.packet instanceof S45PacketTitle) {
+ S45PacketTitle packet = (S45PacketTitle) event.packet;
+
+ if (packet.getMessage() == null) return;
+
+ String message = packet.getMessage().getUnformattedText();
+ for (String user : users) {
+ if (message.contains(user)) {
+ try {
+ messageField.setAccessible(true);
+ messageField.set(packet, replaceChat(packet.getMessage(), user));
+ event.packet = packet;
+ } catch (IllegalAccessException ex) {
+ ex.printStackTrace();
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
public void onWorldChange(WorldEvent.Load event) {
nametags.clear();
}
diff --git a/src/main/java/me/Danker/features/DungeonScore.java b/src/main/java/me/Danker/features/DungeonScore.java
index 2b6b287..706ce62 100644
--- a/src/main/java/me/Danker/features/DungeonScore.java
+++ b/src/main/java/me/Danker/features/DungeonScore.java
@@ -5,12 +5,10 @@ import me.Danker.commands.MoveCommand;
import me.Danker.commands.ScaleCommand;
import me.Danker.commands.ToggleCommand;
import me.Danker.events.RenderOverlayEvent;
-import me.Danker.handlers.ConfigHandler;
import me.Danker.handlers.ScoreboardHandler;
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.network.NetworkPlayerInfo;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
diff --git a/src/main/java/me/Danker/gui/CustomMusicGui.java b/src/main/java/me/Danker/gui/CustomMusicGui.java
index 6695b9a..4d5dcc9 100644
--- a/src/main/java/me/Danker/gui/CustomMusicGui.java
+++ b/src/main/java/me/Danker/gui/CustomMusicGui.java
@@ -1,6 +1,5 @@
package me.Danker.gui;
-import me.Danker.DankersSkyblockMod;
import me.Danker.commands.ToggleCommand;
import me.Danker.features.CustomMusic;
import me.Danker.handlers.ConfigHandler;
diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java
index 6edffa9..d5e9ee8 100644
--- a/src/main/java/me/Danker/gui/DankerGui.java
+++ b/src/main/java/me/Danker/gui/DankerGui.java
@@ -1,12 +1,10 @@
package me.Danker.gui;
-import me.Danker.DankersSkyblockMod;
import me.Danker.commands.ToggleCommand;
import me.Danker.gui.alerts.AlertsGui;
import me.Danker.gui.buttons.FeatureButton;
import me.Danker.gui.crystalhollowwaypoints.CrystalHollowWaypointsGui;
import me.Danker.handlers.ConfigHandler;
-import me.Danker.handlers.TextRenderer;
import me.Danker.utils.RenderUtils;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java
index 4da92c6..17726f8 100644
--- a/src/main/java/me/Danker/gui/DisplayGui.java
+++ b/src/main/java/me/Danker/gui/DisplayGui.java
@@ -1,9 +1,7 @@
package me.Danker.gui;
-import me.Danker.DankersSkyblockMod;
import me.Danker.features.loot.LootDisplay;
import me.Danker.handlers.ConfigHandler;
-import me.Danker.handlers.TextRenderer;
import me.Danker.utils.RenderUtils;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/me/Danker/gui/ExperimentsGui.java b/src/main/java/me/Danker/gui/ExperimentsGui.java
index 3cc4929..53eb118 100644
--- a/src/main/java/me/Danker/gui/ExperimentsGui.java
+++ b/src/main/java/me/Danker/gui/ExperimentsGui.java
@@ -1,6 +1,5 @@
package me.Danker.gui;
-import me.Danker.DankersSkyblockMod;
import me.Danker.commands.ToggleCommand;
import me.Danker.handlers.ConfigHandler;
import me.Danker.utils.Utils;
diff --git a/src/main/java/me/Danker/gui/OnlySlayerGui.java b/src/main/java/me/Danker/gui/OnlySlayerGui.java
index a5674f8..2a6d844 100644
--- a/src/main/java/me/Danker/gui/OnlySlayerGui.java
+++ b/src/main/java/me/Danker/gui/OnlySlayerGui.java
@@ -1,12 +1,8 @@
package me.Danker.gui;
-import me.Danker.DankersSkyblockMod;
-import me.Danker.commands.ToggleCommand;
import me.Danker.features.BlockWrongSlayer;
import me.Danker.handlers.ConfigHandler;
-import me.Danker.handlers.TextRenderer;
import me.Danker.utils.RenderUtils;
-import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java
index 3356ead..0cfa72b 100644
--- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java
+++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java
@@ -1,6 +1,5 @@
package me.Danker.gui;
-import me.Danker.DankersSkyblockMod;
import me.Danker.commands.ToggleCommand;
import me.Danker.handlers.ConfigHandler;
import me.Danker.utils.Utils;
diff --git a/src/main/java/me/Danker/gui/SkillTrackerGui.java b/src/main/java/me/Danker/gui/SkillTrackerGui.java
index 84cc2e3..e77f785 100644
--- a/src/main/java/me/Danker/gui/SkillTrackerGui.java
+++ b/src/main/java/me/Danker/gui/SkillTrackerGui.java
@@ -1,9 +1,7 @@
package me.Danker.gui;
-import me.Danker.DankersSkyblockMod;
import me.Danker.features.SkillTracker;
import me.Danker.handlers.ConfigHandler;
-import me.Danker.handlers.TextRenderer;
import me.Danker.utils.RenderUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
diff --git a/src/main/java/me/Danker/gui/WarningGui.java b/src/main/java/me/Danker/gui/WarningGui.java
index bb37b83..901b59e 100644
--- a/src/main/java/me/Danker/gui/WarningGui.java
+++ b/src/main/java/me/Danker/gui/WarningGui.java
@@ -1,6 +1,5 @@
package me.Danker.gui;
-import me.Danker.handlers.TextRenderer;
import me.Danker.utils.RenderUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
diff --git a/src/main/java/me/Danker/gui/alerts/AlertAddGui.java b/src/main/java/me/Danker/gui/alerts/AlertAddGui.java
index 9014ea1..efc099c 100644
--- a/src/main/java/me/Danker/gui/alerts/AlertAddGui.java
+++ b/src/main/java/me/Danker/gui/alerts/AlertAddGui.java
@@ -1,7 +1,5 @@
package me.Danker.gui.alerts;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import me.Danker.features.Alerts;
import me.Danker.handlers.TextRenderer;
import net.minecraft.client.Minecraft;
@@ -11,7 +9,6 @@ import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.fml.client.config.GuiCheckBox;
-import java.io.FileWriter;
import java.io.IOException;
public class AlertAddGui extends GuiScreen {
diff --git a/src/main/java/me/Danker/gui/alerts/AlertsGui.java b/src/main/java/me/Danker/gui/alerts/AlertsGui.java
index 8eaedca..d73d56a 100644
--- a/src/main/java/me/Danker/gui/alerts/AlertsGui.java
+++ b/src/main/java/me/Danker/gui/alerts/AlertsGui.java
@@ -5,7 +5,6 @@ import me.Danker.features.Alerts;
import me.Danker.gui.DankerGui;
import me.Danker.gui.buttons.FeatureButton;
import me.Danker.handlers.ConfigHandler;
-import me.Danker.handlers.TextRenderer;
import me.Danker.utils.RenderUtils;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java
index 30447a0..8d6fa85 100644
--- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java
+++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointActionGui.java
@@ -2,7 +2,6 @@ package me.Danker.gui.crystalhollowwaypoints;
import me.Danker.DankersSkyblockMod;
import me.Danker.features.CrystalHollowWaypoints;
-import me.Danker.handlers.TextRenderer;
import me.Danker.utils.RenderUtils;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java
index 2331ec0..fc0f108 100644
--- a/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java
+++ b/src/main/java/me/Danker/gui/crystalhollowwaypoints/CrystalHollowWaypointsGui.java
@@ -1,12 +1,10 @@
package me.Danker.gui.crystalhollowwaypoints;
-import me.Danker.DankersSkyblockMod;
import me.Danker.commands.ToggleCommand;
import me.Danker.features.CrystalHollowWaypoints;
import me.Danker.gui.DankerGui;
import me.Danker.gui.buttons.FeatureButton;
import me.Danker.handlers.ConfigHandler;
-import me.Danker.handlers.TextRenderer;
import me.Danker.utils.RenderUtils;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index e5ed372..3839766 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -2,7 +2,6 @@ package me.Danker.handlers;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
import me.Danker.DankersSkyblockMod;
import me.Danker.commands.MoveCommand;
import me.Danker.commands.ScaleCommand;
@@ -16,7 +15,10 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
-import java.io.*;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
index 682c5af..8c48c54 100644
--- a/src/main/java/me/Danker/utils/Utils.java
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -9,7 +9,6 @@ import me.Danker.handlers.ScoreboardHandler;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.network.NetworkPlayerInfo;
-import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.player.EntityPlayer;