diff options
Diffstat (limited to 'src/main/java/me/Danker/features')
-rw-r--r-- | src/main/java/me/Danker/features/ArachneESP.java | 2 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/ColouredNames.java | 27 |
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"; |