13
0
geforkt von Mirrors/Paper

Fix NBT type issues

Addresses two issues:
- MC-135506: Experience should save as Integers
- Allay duplication cooldown is saved and exposed as a long, but loaded as an int
Dieser Commit ist enthalten in:
Aikar 2018-08-03 00:04:54 -04:00
Ursprung 88409ad861
Commit 394e4c04f7
2 geänderte Dateien mit 22 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -159,17 +159,22 @@
} }
return true; return true;
@@ -228,6 +313,7 @@ @@ -226,33 +311,35 @@
public void addAdditionalSaveData(CompoundTag nbt) {
nbt.putShort("Health", (short) this.health);
nbt.putShort("Age", (short) this.age); nbt.putShort("Age", (short) this.age);
nbt.putShort("Value", (short) this.value); - nbt.putShort("Value", (short) this.value);
+ nbt.putInt("Value", this.value); // Paper - save as Integer
nbt.putInt("Count", this.count); nbt.putInt("Count", this.count);
+ this.savePaperNBT(nbt); // Paper + this.savePaperNBT(nbt); // Paper
} }
@Override @Override
@@ -236,23 +322,24 @@ public void readAdditionalSaveData(CompoundTag nbt) {
this.health = nbt.getShort("Health");
this.age = nbt.getShort("Age"); this.age = nbt.getShort("Age");
this.value = nbt.getShort("Value"); - this.value = nbt.getShort("Value");
+ this.value = nbt.getInt("Value"); // Paper - load as Integer
this.count = Math.max(nbt.getInt("Count"), 1); this.count = Math.max(nbt.getInt("Count"), 1);
+ this.loadPaperNBT(nbt); // Paper + this.loadPaperNBT(nbt); // Paper
} }

Datei anzeigen

@ -8,19 +8,19 @@
public Allay(EntityType<? extends Allay> type, Level world) { public Allay(EntityType<? extends Allay> type, Level world) {
super(type, world); super(type, world);
@@ -113,6 +114,12 @@ @@ -114,6 +115,12 @@
this.dynamicVibrationListener = new DynamicGameEventListener<>(new VibrationSystem.Listener(this));
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.JukeboxListener(this.vibrationUser.getPositionSource(), ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius())); this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.JukeboxListener(this.vibrationUser.getPositionSource(), ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()));
} }
+
+ // CraftBukkit start + // CraftBukkit start
+ public void setCanDuplicate(boolean canDuplicate) { + public void setCanDuplicate(boolean canDuplicate) {
+ this.entityData.set(Allay.DATA_CAN_DUPLICATE, canDuplicate); + this.entityData.set(Allay.DATA_CAN_DUPLICATE, canDuplicate);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
protected Brain.Provider<Allay> brainProvider() { protected Brain.Provider<Allay> brainProvider() {
return Brain.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
@@ -126,7 +133,7 @@ @@ -126,7 +133,7 @@
@Override @Override
@ -70,6 +70,15 @@
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX); return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
} }
@@ -486,7 +499,7 @@
});
}
- this.duplicationCooldown = (long) nbt.getInt("DuplicationCooldown");
+ this.duplicationCooldown = nbt.getLong("DuplicationCooldown"); // Paper - Load as long
this.entityData.set(Allay.DATA_CAN_DUPLICATE, nbt.getBoolean("CanDuplicate"));
}
@@ -506,7 +519,7 @@ @@ -506,7 +519,7 @@
} }