aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNoah van der Aa <[email protected]>2022-10-22 16:16:24 +0200
committerGitHub <[email protected]>2022-10-22 16:16:24 +0200
commita163a96a8d3adbfefdfa8a3f7a3e269dedad2e35 (patch)
tree3a2548e0e9a419e37b9645da52b0742a20f73550
parenteb494184a8f6673d62357a22ac748debddad4435 (diff)
downloadPaper-a163a96a8d3adbfefdfa8a3f7a3e269dedad2e35.tar.gz
Paper-a163a96a8d3adbfefdfa8a3f7a3e269dedad2e35.zip
Load Allay duplication cooldown as a long (#8410)
It is saved as a long, and the API exposes a long, so loading it as an int may cause issues like overflows.
-rw-r--r--patches/server/0236-Fix-NBT-type-issues.patch (renamed from patches/server/0236-MC-135506-Experience-should-save-as-Integers.patch)18
1 files changed, 17 insertions, 1 deletions
diff --git a/patches/server/0236-MC-135506-Experience-should-save-as-Integers.patch b/patches/server/0236-Fix-NBT-type-issues.patch
index 009e8580ee..b8f7a3afbb 100644
--- a/patches/server/0236-MC-135506-Experience-should-save-as-Integers.patch
+++ b/patches/server/0236-Fix-NBT-type-issues.patch
@@ -1,8 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Fri, 3 Aug 2018 00:04:54 -0400
-Subject: [PATCH] MC-135506: Experience should save as Integers
+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
@@ -26,3 +29,16 @@ index 2fead19c1c4b04f94999887b196ceaee025edd99..2d1228670696224452cb432e0279456d
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"));
+ }
+