aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-26 16:56:42 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-26 16:56:42 +0200
commite3344f636e48bb56e9dd028760b69134cce19c49 (patch)
tree5add6f3c7204ac858f463aef275a849a50d168e5 /src/main/java/at/hannibal2
parentf82c30cbd7c191051aae239b9df06c2c2181c8d4 (diff)
downloadskyhanni-e3344f636e48bb56e9dd028760b69134cce19c49.tar.gz
skyhanni-e3344f636e48bb56e9dd028760b69134cce19c49.tar.bz2
skyhanni-e3344f636e48bb56e9dd028760b69134cce19c49.zip
Added Teleport Pad Compact Name - Hide the 'Warp to' and 'No Destination' texts over teleport pads.
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt32
3 files changed, 44 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index f3909ebce..00a4e68d1 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -232,6 +232,7 @@ public class SkyHanniMod {
loadModule(new FarmingArmorDrops());
loadModule(new JoinCrystalHollows());
loadModule(new GardenVisitorColorNames());
+ loadModule(new GardenTeleportPadCompactName());
Commands.INSTANCE.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
index eacdea6cd..06056903e 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -567,6 +567,17 @@ public class Garden {
public Position farmingArmorDropsPos = new Position(16, -232, false, true);
@Expose
+ @ConfigOption(name = "Teleport Pads", desc = "")
+ @ConfigEditorAccordion(id = 12)
+ public boolean teleportPads = false;
+
+ @Expose
+ @ConfigOption(name = "Compact Name", desc = "Hide the 'Warp to' and 'No Destination' texts over teleport pads.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 12)
+ public boolean teleportPadsCompactName = false;
+
+ @Expose
@ConfigOption(name = "Plot Price", desc = "Show the price of the plot in coins when inside the Configure Plots inventory.")
@ConfigEditorBoolean
public boolean plotPrice = true;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt
new file mode 100644
index 000000000..95e50dff2
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt
@@ -0,0 +1,32 @@
+package at.hannibal2.skyhanni.features.garden
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import net.minecraft.entity.EntityLivingBase
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraftforge.client.event.RenderLivingEvent
+import net.minecraftforge.fml.common.eventhandler.EventPriority
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.regex.Pattern
+
+class GardenTeleportPadCompactName {
+ private val patternName = Pattern.compile("§.✦ §aWarp To (.*)")
+ private val patternNoName = Pattern.compile("§.✦ §cNo Destination")
+
+ @SubscribeEvent(priority = EventPriority.HIGH)
+ fun onRenderLivingB(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
+ if (!SkyHanniMod.feature.garden.teleportPadsCompactName) return
+ val entity = event.entity
+ if (entity !is EntityArmorStand) return
+
+ val name = entity.name
+
+ if (patternNoName.matcher(name).matches()) {
+ event.isCanceled = true
+ }
+
+ val matcher = patternName.matcher(name)
+ if (matcher.matches()) {
+ entity.customNameTag = matcher.group(1)
+ }
+ }
+} \ No newline at end of file