aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-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