fix ArmorStandMeta not applying false flags (#8632)

This commit is contained in:
TehBrian 2022-12-23 12:30:42 -05:00
parent b8a1f20c8d
commit 0ece030a7d

View file

@ -31,11 +31,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ static final ItemMetaKey SMALL = new ItemMetaKey("Small", "small"); + static final ItemMetaKey SMALL = new ItemMetaKey("Small", "small");
+ static final ItemMetaKey MARKER = new ItemMetaKey("Marker", "marker"); + static final ItemMetaKey MARKER = new ItemMetaKey("Marker", "marker");
+ +
+ private boolean invisible; + private Boolean invisible = null;
+ private boolean noBasePlate; + private Boolean noBasePlate = null;
+ private boolean showArms; + private Boolean showArms = null;
+ private boolean small; + private Boolean small = null;
+ private boolean marker; + private Boolean marker = null;
+ // Paper end + // Paper end
CompoundTag entityTag; CompoundTag entityTag;
@ -103,23 +103,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.entityTag = new CompoundTag(); + this.entityTag = new CompoundTag();
+ } + }
+ +
+ if (isInvisible()) { + if (this.invisible != null) {
+ this.entityTag.putBoolean(INVISIBLE.NBT, this.invisible); + this.entityTag.putBoolean(INVISIBLE.NBT, this.invisible);
+ } + }
+ +
+ if (hasNoBasePlate()) { + if (this.noBasePlate != null) {
+ this.entityTag.putBoolean(NO_BASE_PLATE.NBT, this.noBasePlate); + this.entityTag.putBoolean(NO_BASE_PLATE.NBT, this.noBasePlate);
+ } + }
+ +
+ if (shouldShowArms()) { + if (this.showArms != null) {
+ this.entityTag.putBoolean(SHOW_ARMS.NBT, this.showArms); + this.entityTag.putBoolean(SHOW_ARMS.NBT, this.showArms);
+ } + }
+ +
+ if (isSmall()) { + if (this.small != null) {
+ this.entityTag.putBoolean(SMALL.NBT, this.small); + this.entityTag.putBoolean(SMALL.NBT, this.small);
+ } + }
+ +
+ if (isMarker()) { + if (this.marker != null) {
+ this.entityTag.putBoolean(MARKER.NBT, this.marker); + this.entityTag.putBoolean(MARKER.NBT, this.marker);
+ } + }
+ // Paper end + // Paper end
@ -131,7 +131,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
boolean isArmorStandEmpty() { boolean isArmorStandEmpty() {
- return !(this.entityTag != null); - return !(this.entityTag != null);
+ return !(this.isInvisible() || this.hasNoBasePlate() || this.shouldShowArms() || this.isSmall() || this.isMarker() || this.entityTag != null); + return !(this.invisible != null || this.noBasePlate != null || this.showArms != null || this.small != null || this.marker != null || this.entityTag != null); // Paper
} }
@Override @Override
@ -173,23 +173,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.serialize(builder); super.serialize(builder);
+ // Paper start + // Paper start
+ if (this.isInvisible()) { + if (invisible != null) {
+ builder.put(INVISIBLE.BUKKIT, invisible); + builder.put(INVISIBLE.BUKKIT, invisible);
+ } + }
+ +
+ if (this.hasNoBasePlate()) { + if (noBasePlate != null) {
+ builder.put(NO_BASE_PLATE.BUKKIT, noBasePlate); + builder.put(NO_BASE_PLATE.BUKKIT, noBasePlate);
+ } + }
+ +
+ if (this.shouldShowArms()) { + if (showArms != null) {
+ builder.put(SHOW_ARMS.BUKKIT, showArms); + builder.put(SHOW_ARMS.BUKKIT, showArms);
+ } + }
+ +
+ if (this.isSmall()) { + if (small != null) {
+ builder.put(SMALL.BUKKIT, small); + builder.put(SMALL.BUKKIT, small);
+ } + }
+ +
+ if (this.isMarker()) { + if (marker != null) {
+ builder.put(MARKER.BUKKIT, marker); + builder.put(MARKER.BUKKIT, marker);
+ } + }
+ // Paper end + // Paper end
@ -205,27 +205,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ @Override + @Override
+ public boolean isInvisible() { + public boolean isInvisible() {
+ return invisible; + return invisible != null && invisible;
+ } + }
+ +
+ @Override + @Override
+ public boolean hasNoBasePlate() { + public boolean hasNoBasePlate() {
+ return noBasePlate; + return noBasePlate != null && noBasePlate;
+ } + }
+ +
+ @Override + @Override
+ public boolean shouldShowArms() { + public boolean shouldShowArms() {
+ return showArms; + return showArms != null && showArms;
+ } + }
+ +
+ @Override + @Override
+ public boolean isSmall() { + public boolean isSmall() {
+ return small; + return small != null && small;
+ } + }
+ +
+ @Override + @Override
+ public boolean isMarker() { + public boolean isMarker() {
+ return marker; + return marker != null && marker;
+ } + }
+ +
+ @Override + @Override