aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/features/SexAura.java
diff options
context:
space:
mode:
authorRoseGoldIsntGay <yoavkau@gmail.com>2022-01-27 20:44:16 +0200
committerRoseGoldIsntGay <yoavkau@gmail.com>2022-01-27 20:44:16 +0200
commitf4b58abbda168b01513a5ac2ba2870bc00df7074 (patch)
tree2f237367764c74bba1f912acec1da281a2b74d24 /src/main/java/rosegoldaddons/features/SexAura.java
parentfdc569f2ab7674d850d25b41519b4e3da244dd00 (diff)
downloadRGA-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.java28
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);
}
}