Paper/patches/server/0234-Fix-NBT-type-issues.patch

45 lines
2.3 KiB
Diff
Raw Normal View History

2021-06-13 01:45:00 +02:00
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
2021-06-13 01:45:00 +02:00
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
2021-06-13 01:45:00 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index ea2e30e405426ed0d3b6b912512f5c4332d91b1d..000c13afc6bb3acb68b9adcaeefb7bb1cb703702 100644
2021-06-13 01:45:00 +02:00
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
2023-06-07 22:19:14 +02:00
@@ -293,7 +293,7 @@ public class ExperienceOrb extends Entity {
2021-06-13 01:45:00 +02:00
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
}
2023-06-07 22:19:14 +02:00
@@ -302,7 +302,7 @@ public class ExperienceOrb extends Entity {
2021-06-13 01:45:00 +02:00
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
2023-06-07 22:19:14 +02:00
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
2023-06-07 22:19:14 +02:00
@@ -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"));
}