Skip to content

Commit 03f2c31

Browse files
committed
make hologram lifespan and transparency level configurable.
1 parent 9b318f6 commit 03f2c31

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,11 @@ public void draw(Tessellator tes) {
328328
int brightness = w.blockExists(x, 0, z) ? w.getLightBrightnessForSkyBlocks(x, y, z, 0) : 0;
329329
tes.setBrightness(brightness);
330330

331-
tes.setColorRGBA((int) (tint[0] * .9F), (int) (tint[1] * .95F), (int) (tint[2] * 1F), 192);
331+
tes.setColorRGBA(
332+
(int) (tint[0] * .9F),
333+
(int) (tint[1] * .95F),
334+
(int) (tint[2] * 1F),
335+
ConfigurationHandler.INSTANCE.getHintTransparency());
332336

333337
for (int i = 0; i < 6; i++) {
334338
if (icons[i] == null) continue;
@@ -403,7 +407,8 @@ public void onClientTick(ClientTickEvent e) {
403407
boolean sortRequired = false;
404408
// The allGroups is implicitly sorted by creationTime
405409
// here we exploit this ordering to reduce iteration size
406-
int deadline = Minecraft.getMinecraft().thePlayer.ticksExisted - HOLOGRAM_LIFETIME;
410+
int deadline = Minecraft.getMinecraft().thePlayer.ticksExisted
411+
- ConfigurationHandler.INSTANCE.getHintLifespan();
407412
int i;
408413
for (i = 0; i < allGroups.size(); i++) {
409414
if (allGroups.get(i).getCreationTime() > deadline) {

src/main/java/com/gtnewhorizon/structurelib/ConfigurationHandler.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public enum ConfigurationHandler {
1515
private Configuration config;
1616
private int maxCoexistingHologram;
1717
private boolean removeCollidingHologram;
18+
private int hintLifespan;
19+
private int hintTransparency;
1820
private int autoPlaceBudget;
1921
private int autoPlaceInterval;
2022

@@ -52,6 +54,15 @@ private void loadConfig() {
5254
"client.hologram",
5355
true,
5456
"An attempt will be made to remove an existing hologram if it collides with a new hologram.");
57+
hintLifespan =
58+
config.getInt("hintLifespan", "client.hologram", 400, 1, 20000, "Ticks before a hologram disappears.");
59+
hintTransparency = config.getInt(
60+
"hintTransparency",
61+
"client.hologram",
62+
192,
63+
1,
64+
255,
65+
"Alpha value of hologram particles. Higher the value, the more \"ghostly\" the hologram will appear to be.");
5566
autoPlaceBudget = config.getInt(
5667
"autoPlaceBudget",
5768
"common.hologram",
@@ -92,6 +103,14 @@ public boolean isRemoveCollidingHologram() {
92103
return removeCollidingHologram;
93104
}
94105

106+
public int getHintLifespan() {
107+
return hintLifespan;
108+
}
109+
110+
public int getHintTransparency() {
111+
return hintTransparency;
112+
}
113+
95114
public int getAutoPlaceBudget() {
96115
return autoPlaceBudget;
97116
}

0 commit comments

Comments
 (0)