9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2026-01-03 06:02:32 +00:00

fixed is see through

This commit is contained in:
XiaoMoMi
2025-10-16 03:18:18 +08:00
parent dafe373f81
commit 084f7d1edf
9 changed files with 45 additions and 24 deletions

View File

@@ -66,7 +66,7 @@ public class NameTag extends AbstractTag implements RelationalFeature {
0, 0, 0,
component, config.backgroundColor(),
(owner.isSpectator() && affectedBySpectator()) || (owner.isCrouching() && affectedByCrouching()) ? 64 : opacity(),
config.hasShadow(), config.isSeeThrough(), config.useDefaultBackgroundColor(),
config.hasShadow(), config.isSeeThrough().asBoolean() && (!affectedByCrouching() || !tracker.isCrouching()), config.useDefaultBackgroundColor(),
config.alignment(), config.viewRange(), config.shadowRadius(), config.shadowStrength(),
(affectedByScaling() ? scale(viewer).multiply(tracker.getScale()) : scale(viewer)),
(affectedByScaling() ? translation(viewer).multiply(tracker.getScale()) : translation(viewer)),
@@ -77,7 +77,9 @@ public class NameTag extends AbstractTag implements RelationalFeature {
@Override
public void darkTag(CNPlayer viewer, boolean dark) {
Consumer<List<Object>> modifiers = CustomNameplates.getInstance().getPlatform().createSneakModifier(dark, this.config);
Tracker tracker = owner.getTracker(viewer);
boolean seeThrough = config.isSeeThrough().asBoolean() && (!affectedByCrouching() || !tracker.isCrouching());
Consumer<List<Object>> modifiers = CustomNameplates.getInstance().getPlatform().createSneakModifier(dark, seeThrough, this.config);
Object packet = CustomNameplates.getInstance().getPlatform().updateTextDisplayPacket(entityID, List.of(modifiers));
CustomNameplates.getInstance().getPacketSender().sendPacket(viewer, packet);
}

View File

@@ -43,6 +43,7 @@ import net.momirealms.customnameplates.api.requirement.Requirement;
import net.momirealms.customnameplates.api.util.Alignment;
import net.momirealms.customnameplates.api.util.ConfigUtils;
import net.momirealms.customnameplates.api.util.Vector3;
import net.momirealms.customnameplates.common.util.Tristate;
import java.io.File;
import java.io.IOException;
@@ -302,7 +303,7 @@ public class UnlimitedTagManagerImpl implements UnlimitedTagManager, PlayerListe
.shadowStrength(section.getFloat("shadow-strength", 1f))
.lineWidth(section.getInt("line-width", 200))
.hasShadow(section.getBoolean("has-shadow", false))
.seeThrough(section.getBoolean("is-see-through", false))
.seeThrough(Tristate.fromBoolean((Boolean) section.get("is-see-through")))
.opacity(section.getByte("opacity", (byte) -1))
.useDefaultBackgroundColor(section.getBoolean("use-default-background-color", false))
.backgroundColor(ConfigUtils.argb(section.getString("background-color", "64,0,0,0")))

View File

@@ -22,6 +22,7 @@ unlimited:
affected-by-spectator: true
line-width: 1024
background-color: 64,0,0,0
is-see-through: false
tag_image_part:
text: '%np_tag-image%'
translation: 0,0.2,0
@@ -35,6 +36,7 @@ unlimited:
affected-by-spectator: true
line-width: 1024
background-color: 0,0,0,0
is-see-through: false
tag_text_part:
text: '%np_tag-text%'
translation: 0.01,0.2,0.01
@@ -47,4 +49,5 @@ unlimited:
affected-by-scale-attribute: true
affected-by-spectator: true
line-width: 1024
background-color: 0,0,0,0
background-color: 0,0,0,0
is-see-through: false