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
This commit is contained in:
Aikar
2018-08-03 00:04:54 -04:00
parent 88409ad861
commit 394e4c04f7
2 changed files with 22 additions and 8 deletions

View File

@@ -159,17 +159,22 @@
}
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("Value", (short) this.value);
- nbt.putShort("Value", (short) this.value);
+ nbt.putInt("Value", this.value); // Paper - save as Integer
nbt.putInt("Count", this.count);
+ this.savePaperNBT(nbt); // Paper
}
@Override
@@ -236,23 +322,24 @@
public void readAdditionalSaveData(CompoundTag nbt) {
this.health = nbt.getShort("Health");
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.loadPaperNBT(nbt); // Paper
}