diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-27 20:44:16 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2022-01-27 20:44:16 +0200 |
commit | f4b58abbda168b01513a5ac2ba2870bc00df7074 (patch) | |
tree | 2f237367764c74bba1f912acec1da281a2b74d24 /src/main/java/rosegoldaddons/features/SexAura.java | |
parent | fdc569f2ab7674d850d25b41519b4e3da244dd00 (diff) | |
download | RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.tar.gz RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.tar.bz2 RGA-f4b58abbda168b01513a5ac2ba2870bc00df7074.zip |
2.7.0-pre2
Diffstat (limited to 'src/main/java/rosegoldaddons/features/SexAura.java')
-rw-r--r-- | src/main/java/rosegoldaddons/features/SexAura.java | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/main/java/rosegoldaddons/features/SexAura.java b/src/main/java/rosegoldaddons/features/SexAura.java index 72df86d..54e88f2 100644 --- a/src/main/java/rosegoldaddons/features/SexAura.java +++ b/src/main/java/rosegoldaddons/features/SexAura.java @@ -1,10 +1,15 @@ package rosegoldaddons.features; -import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import rosegoldaddons.Main; +import rosegoldaddons.events.RenderLivingEntityEvent; + +import java.util.Map; public class SexAura { @SubscribeEvent(priority = EventPriority.HIGHEST) @@ -15,19 +20,34 @@ public class SexAura { if (message.startsWith("From") && message.contains("!SXAURA!")) { event.setCanceled(true); String sender = formatted.substring(formatted.indexOf("From")+5, formatted.indexOf(":")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } if(message.startsWith("§9Party") && message.contains("!SXAURA!")) { event.setCanceled(true); String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); + Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!")); playAlert(); } } } + @SubscribeEvent + public void onEntityRender(RenderLivingEntityEvent event) { + if (Main.init) { + String text = event.entity.getDisplayName().getFormattedText(); + for (Map.Entry<String, String> entry : Main.resp.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (text.contains(key) && !text.contains(value)) { + event.entity.setCustomNameTag(text.replace(key, value)); + break; + } + } + } + } + private static void playAlert() { - Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, 0.5F); + Main.mc.thePlayer.playSound("random.orb", 1, 0.5F); } } |