aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2021-07-11 17:18:07 -0400
committerbowser0000 <bowser0000@gmail.com>2021-07-11 17:18:07 -0400
commit6eed0d48eeaa054392efe19dffaef691701c1356 (patch)
tree8af7714bff21f8f58b14a9c385f2188e393f7eb0 /src/main/java/me/Danker/features
parent4e70985c1b6cd71505ab6dc96c8abcd1600948df (diff)
downloadSkyblockMod-6eed0d48eeaa054392efe19dffaef691701c1356.tar.gz
SkyblockMod-6eed0d48eeaa054392efe19dffaef691701c1356.tar.bz2
SkyblockMod-6eed0d48eeaa054392efe19dffaef691701c1356.zip
Add custom colours to nametags
Also fix Spider's Den detection and fix copy paste error in /toggle
Diffstat (limited to 'src/main/java/me/Danker/features')
-rw-r--r--src/main/java/me/Danker/features/ArachneESP.java2
-rw-r--r--src/main/java/me/Danker/features/ColouredNames.java27
2 files changed, 28 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/features/ArachneESP.java b/src/main/java/me/Danker/features/ArachneESP.java
index c78c385..7e39a8f 100644
--- a/src/main/java/me/Danker/features/ArachneESP.java
+++ b/src/main/java/me/Danker/features/ArachneESP.java
@@ -32,7 +32,7 @@ public class ArachneESP {
public boolean inSpidersDen(List<String> scoreboard) {
for (String s : scoreboard) {
- if (ScoreboardHandler.cleanSB(s).contains("Spiders Den")) {
+ if (ScoreboardHandler.cleanSB(s).contains("Spider's Den")) {
return true;
}
}
diff --git a/src/main/java/me/Danker/features/ColouredNames.java b/src/main/java/me/Danker/features/ColouredNames.java
index 478a47d..2156f3a 100644
--- a/src/main/java/me/Danker/features/ColouredNames.java
+++ b/src/main/java/me/Danker/features/ColouredNames.java
@@ -3,11 +3,15 @@ package me.Danker.features;
import me.Danker.DankersSkyblockMod;
import me.Danker.commands.ToggleCommand;
import me.Danker.utils.Utils;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.ArrayList;
@@ -43,6 +47,29 @@ public class ColouredNames {
}
}
+ @SubscribeEvent
+ public void onRenderNametag(PlayerEvent.NameFormat event) {
+ if (!ToggleCommand.customColouredNames || !Utils.inSkyblock) return;
+
+ if (users.contains(event.username)) {
+ event.displayname = replaceName(event.displayname, event.username, getColourFromName(event.username));
+ }
+ }
+
+ @SubscribeEvent
+ public void onRenderLiving(RenderLivingEvent.Specials.Pre<EntityLivingBase> event) {
+ if (!ToggleCommand.customColouredNames || !Utils.inSkyblock) return;
+
+ Entity entity = event.entity;
+ if (entity.hasCustomName()) {
+ for (String user : users) {
+ if (entity.getCustomNameTag().contains(user)) {
+ entity.setCustomNameTag(replaceName(entity.getCustomNameTag(), user, getColourFromName(user)));
+ }
+ }
+ }
+ }
+
// https://github.com/SteveKunG/SkyBlockcatia/blob/1.8.9/src/main/java/com/stevekung/skyblockcatia/utils/SupporterUtils.java#L53
public static String replaceName(String text, String name, String colour) {
String namePattern = "(?:(?:\\u00a7[0-9a-fbr])\\B(?:" + name + ")\\b)|(?:\\u00a7[rb]" + name + "\\u00a7r)|\\b" + name + "\\b";