From 03f2c311912fc427544280a6ac5b92bf7b1cd236 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Fri, 2 Sep 2022 16:44:12 +0800 Subject: [PATCH] make hologram lifespan and transparency level configurable. --- .../structurelib/ClientProxy.java | 9 +++++++-- .../structurelib/ConfigurationHandler.java | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java b/src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java index 56e20ccc..6eecee45 100644 --- a/src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java +++ b/src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java @@ -328,7 +328,11 @@ public class ClientProxy extends CommonProxy { int brightness = w.blockExists(x, 0, z) ? w.getLightBrightnessForSkyBlocks(x, y, z, 0) : 0; tes.setBrightness(brightness); - tes.setColorRGBA((int) (tint[0] * .9F), (int) (tint[1] * .95F), (int) (tint[2] * 1F), 192); + tes.setColorRGBA( + (int) (tint[0] * .9F), + (int) (tint[1] * .95F), + (int) (tint[2] * 1F), + ConfigurationHandler.INSTANCE.getHintTransparency()); for (int i = 0; i < 6; i++) { if (icons[i] == null) continue; @@ -403,7 +407,8 @@ public class ClientProxy extends CommonProxy { boolean sortRequired = false; // The allGroups is implicitly sorted by creationTime // here we exploit this ordering to reduce iteration size - int deadline = Minecraft.getMinecraft().thePlayer.ticksExisted - HOLOGRAM_LIFETIME; + int deadline = Minecraft.getMinecraft().thePlayer.ticksExisted + - ConfigurationHandler.INSTANCE.getHintLifespan(); int i; for (i = 0; i < allGroups.size(); i++) { if (allGroups.get(i).getCreationTime() > deadline) { diff --git a/src/main/java/com/gtnewhorizon/structurelib/ConfigurationHandler.java b/src/main/java/com/gtnewhorizon/structurelib/ConfigurationHandler.java index 61bf6869..bcb479c6 100644 --- a/src/main/java/com/gtnewhorizon/structurelib/ConfigurationHandler.java +++ b/src/main/java/com/gtnewhorizon/structurelib/ConfigurationHandler.java @@ -15,6 +15,8 @@ public enum ConfigurationHandler { private Configuration config; private int maxCoexistingHologram; private boolean removeCollidingHologram; + private int hintLifespan; + private int hintTransparency; private int autoPlaceBudget; private int autoPlaceInterval; @@ -52,6 +54,15 @@ public enum ConfigurationHandler { "client.hologram", true, "An attempt will be made to remove an existing hologram if it collides with a new hologram."); + hintLifespan = + config.getInt("hintLifespan", "client.hologram", 400, 1, 20000, "Ticks before a hologram disappears."); + hintTransparency = config.getInt( + "hintTransparency", + "client.hologram", + 192, + 1, + 255, + "Alpha value of hologram particles. Higher the value, the more \"ghostly\" the hologram will appear to be."); autoPlaceBudget = config.getInt( "autoPlaceBudget", "common.hologram", @@ -92,6 +103,14 @@ public enum ConfigurationHandler { return removeCollidingHologram; } + public int getHintLifespan() { + return hintLifespan; + } + + public int getHintTransparency() { + return hintTransparency; + } + public int getAutoPlaceBudget() { return autoPlaceBudget; }