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