From ddc8e1fd7c0e23a7862334222e50597204dd245a Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Sat, 22 Oct 2022 16:16:24 +0200 Subject: [PATCH] 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. --- ...ntegers.patch => Fix-NBT-type-issues.patch} | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) rename patches/server/{MC-135506-Experience-should-save-as-Integers.patch => Fix-NBT-type-issues.patch} (58%) diff --git a/patches/server/MC-135506-Experience-should-save-as-Integers.patch b/patches/server/Fix-NBT-type-issues.patch similarity index 58% rename from patches/server/MC-135506-Experience-should-save-as-Integers.patch rename to patches/server/Fix-NBT-type-issues.patch index 45d3690918..0888672db3 100644 --- a/patches/server/MC-135506-Experience-should-save-as-Integers.patch +++ b/patches/server/Fix-NBT-type-issues.patch @@ -1,8 +1,11 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -26,3 +29,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +@@ -0,0 +0,0 @@ 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")); + } +