Paper/patches/server/0234-Fix-NBT-type-issues.patch
2023-06-08 23:52:18 -07:00

45 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 ff682a671f04a333615c4f22dc4b2aedd00eb117..8d8fe55a05eea237a8af99ed15ab16d6167daa77 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -295,7 +295,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
}
@@ -304,7 +304,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 33a058474cd9d5e089a39e04cf5176eb9df62603..339c70f101d026a100a801e66cf514b3329a89d2 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
@@ -514,7 +514,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
});
}
- 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"));
}