mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
a163a96a8d
It is saved as a long, and the API exposes a long, so loading it as an int may cause issues like overflows.
44 lines
2.3 KiB
Diff
44 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Fri, 3 Aug 2018 00:04:54 -0400
|
|
Subject: [PATCH] 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
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
index 2fead19c1c4b04f94999887b196ceaee025edd99..2d1228670696224452cb432e0279456d8c5fe710 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
@@ -286,7 +286,7 @@ public class ExperienceOrb extends Entity {
|
|
public void addAdditionalSaveData(CompoundTag nbt) {
|
|
nbt.putShort("Health", (short) this.health);
|
|
nbt.putShort("Age", (short) this.age);
|
|
- nbt.putShort("Value", (short) this.value);
|
|
+ nbt.putInt("Value", this.value); // Paper - save as Integer
|
|
nbt.putInt("Count", this.count);
|
|
this.savePaperNBT(nbt); // Paper
|
|
}
|
|
@@ -295,7 +295,7 @@ public class ExperienceOrb extends Entity {
|
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
|
this.health = nbt.getShort("Health");
|
|
this.age = nbt.getShort("Age");
|
|
- 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
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
|
index 2d87b740e84435ef9bd3eee3d3e2af9f707a0826..1dcd0c494681b7665b6b86dbe20375afd8d2fad8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
|
@@ -484,7 +484,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier {
|
|
});
|
|
}
|
|
|
|
- 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"));
|
|
}
|
|
|