mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
fixed is see through
This commit is contained in:
@@ -190,7 +190,7 @@ public interface Platform {
|
||||
*/
|
||||
Consumer<List<Object>> createTranslationModifier(Vector3 translation);
|
||||
|
||||
Consumer<List<Object>> createSneakModifier(boolean isSneaking, NameTagConfig config);
|
||||
Consumer<List<Object>> createSneakModifier(boolean isSneaking, boolean seeThrough, NameTagConfig config);
|
||||
|
||||
/**
|
||||
* Updates an existing text display entity with modifiers.
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.momirealms.customnameplates.api.feature.CarouselText;
|
||||
import net.momirealms.customnameplates.api.requirement.Requirement;
|
||||
import net.momirealms.customnameplates.api.util.Alignment;
|
||||
import net.momirealms.customnameplates.api.util.Vector3;
|
||||
import net.momirealms.customnameplates.common.util.Tristate;
|
||||
|
||||
/**
|
||||
* NameTag Configuration
|
||||
@@ -79,10 +80,8 @@ public interface NameTagConfig {
|
||||
/**
|
||||
* Checks if the name tag is see-through.
|
||||
*
|
||||
* @return true if the name tag is see-through, false otherwise
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isSeeThrough();
|
||||
Tristate isSeeThrough();
|
||||
|
||||
/**
|
||||
* Checks if the default background color is used.
|
||||
@@ -245,7 +244,7 @@ public interface NameTagConfig {
|
||||
* @param seeThrough true if the name tag is see-through, false otherwise
|
||||
* @return the builder instance
|
||||
*/
|
||||
Builder seeThrough(boolean seeThrough);
|
||||
Builder seeThrough(Tristate seeThrough);
|
||||
|
||||
/**
|
||||
* Sets whether the name tag uses the default background color.
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.momirealms.customnameplates.api.feature.CarouselText;
|
||||
import net.momirealms.customnameplates.api.requirement.Requirement;
|
||||
import net.momirealms.customnameplates.api.util.Alignment;
|
||||
import net.momirealms.customnameplates.api.util.Vector3;
|
||||
import net.momirealms.customnameplates.common.util.Tristate;
|
||||
|
||||
/**
|
||||
* Implementation of NameTagConfig
|
||||
@@ -34,7 +35,7 @@ public class NameTagConfigImpl implements NameTagConfig {
|
||||
private final byte opacity;
|
||||
private final int backgroundColor;
|
||||
private final boolean hasShadow;
|
||||
private final boolean isSeeThrough;
|
||||
private final Tristate isSeeThrough;
|
||||
private final boolean useDefaultBackgroundColor;
|
||||
private final Alignment alignment;
|
||||
private final float viewRange;
|
||||
@@ -46,7 +47,7 @@ public class NameTagConfigImpl implements NameTagConfig {
|
||||
private final boolean affectedByScale;
|
||||
private final boolean affectedBySpectator;
|
||||
|
||||
private NameTagConfigImpl(String id, Requirement[] ownerRequirements, Requirement[] viewerRequirements, CarouselText[] carouselTexts, int lineWidth, byte opacity, int backgroundColor, boolean hasShadow, boolean isSeeThrough, boolean useDefaultBackgroundColor, Alignment alignment, float viewRange, float shadowRadius, float shadowStrength, Vector3 scale, Vector3 translation, boolean affectedByCrouching, boolean affectedByScale, boolean affectedBySpectator) {
|
||||
private NameTagConfigImpl(String id, Requirement[] ownerRequirements, Requirement[] viewerRequirements, CarouselText[] carouselTexts, int lineWidth, byte opacity, int backgroundColor, boolean hasShadow, Tristate isSeeThrough, boolean useDefaultBackgroundColor, Alignment alignment, float viewRange, float shadowRadius, float shadowStrength, Vector3 scale, Vector3 translation, boolean affectedByCrouching, boolean affectedByScale, boolean affectedBySpectator) {
|
||||
this.id = id;
|
||||
this.ownerRequirements = ownerRequirements;
|
||||
this.viewerRequirements = viewerRequirements;
|
||||
@@ -104,7 +105,7 @@ public class NameTagConfigImpl implements NameTagConfig {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSeeThrough() {
|
||||
public Tristate isSeeThrough() {
|
||||
return isSeeThrough;
|
||||
}
|
||||
|
||||
@@ -175,7 +176,7 @@ public class NameTagConfigImpl implements NameTagConfig {
|
||||
private byte opacity;
|
||||
private int backgroundColor;
|
||||
private boolean hasShadow;
|
||||
private boolean isSeeThrough;
|
||||
private Tristate isSeeThrough;
|
||||
private boolean useDefaultBackgroundColor;
|
||||
private Alignment alignment;
|
||||
private float viewRange;
|
||||
@@ -236,7 +237,7 @@ public class NameTagConfigImpl implements NameTagConfig {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder seeThrough(boolean seeThrough) {
|
||||
public Builder seeThrough(Tristate seeThrough) {
|
||||
this.isSeeThrough = seeThrough;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,21 @@ public enum Tristate {
|
||||
this.booleanValue = booleanValue;
|
||||
}
|
||||
|
||||
public boolean or(boolean val) {
|
||||
if (this == UNDEFINED) {
|
||||
return val;
|
||||
} else {
|
||||
return this.booleanValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static Tristate fromBoolean(Boolean val) {
|
||||
if (val == null) {
|
||||
return UNDEFINED;
|
||||
}
|
||||
return val ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the Tristate as a boolean.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user