From c4782f50a3672d079b8dc47625a9d609458fe409 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:38:12 +0200 Subject: [PATCH] Add xp orb spawn reason for frogs (#8045) --- patches/server/0005-MC-Dev-fixes.patch | 13 ++++++++++ ...PI-for-Reason-Source-Triggering-play.patch | 25 +++++++++++++++---- .../0167-PlayerPickupExperienceEvent.patch | 4 +-- ...6-Experience-should-save-as-Integers.patch | 6 ++--- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/patches/server/0005-MC-Dev-fixes.patch b/patches/server/0005-MC-Dev-fixes.patch index 478d3ead3..80159200f 100644 --- a/patches/server/0005-MC-Dev-fixes.patch +++ b/patches/server/0005-MC-Dev-fixes.patch @@ -192,6 +192,19 @@ index 8760e4199a1c8ae1a784f885923616f3740fe120..bb2be6eea7a0cff4cc70bd43738b1ce2 return instance.group(RecordCodecBuilder.point(updateListener), Codec.BOOL.optionalFieldOf("Valid", Boolean.valueOf(false)).forGetter((poiSet) -> { return poiSet.isValid; }), PoiRecord.codec(updateListener).listOf().fieldOf("Records").forGetter((poiSet) -> { +diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +index 01f8d11ee4441a1c4d87427e3f9bcd7155259a5b..fe660bbaa4113fb2ffa1ea2f10e4e1e674fbb86d 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java ++++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +@@ -105,7 +105,7 @@ public class Frog extends Animal { + + @Override + public Brain getBrain() { +- return super.getBrain(); ++ return (Brain) super.getBrain(); // Paper - decompile fix + } + + @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java index 64314cf4dc53a1a0a5f676fa00503858e0120dfa..45741410a13cffe3419e34b5607b048bbcf1c3ff 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java diff --git a/patches/server/0125-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0125-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 88bd75f5c..c3bca094a 100644 --- a/patches/server/0125-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0125-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -21,10 +21,10 @@ index cd3b4c97374d44f5a0e710e03f4ac38938757e25..b18bb06caf5f034dffbb72120c8f21da return true; diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2d7524542 100644 +index b3433ce9c722bdab81848a6c2d121ca510c48509..16a1a005f2dda30cf804bf51638383ef3bfeb43e 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -37,13 +37,63 @@ public class ExperienceOrb extends Entity { +@@ -37,13 +37,65 @@ public class ExperienceOrb extends Entity { public int value; private int count; private Player followingPlayer; @@ -67,6 +67,8 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2 + nbttagcompound.put("Paper.ExpData", comp); + } ++ @io.papermc.paper.annotation.DoNotUse ++ @Deprecated public ExperienceOrb(Level world, double x, double y, double z, int amount) { + this(world, x, y, z, amount, null, null); + } @@ -90,7 +92,7 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2 } public ExperienceOrb(EntityType type, Level world) { -@@ -153,12 +203,20 @@ public class ExperienceOrb extends Entity { +@@ -153,12 +205,20 @@ public class ExperienceOrb extends Entity { } public static void award(ServerLevel world, Vec3 pos, int amount) { @@ -112,7 +114,7 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2 } } -@@ -228,6 +286,7 @@ public class ExperienceOrb extends Entity { +@@ -228,6 +288,7 @@ public class ExperienceOrb extends Entity { nbt.putShort("Age", (short) this.age); nbt.putShort("Value", (short) this.value); nbt.putInt("Count", this.count); @@ -120,7 +122,7 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2 } @Override -@@ -236,6 +295,7 @@ public class ExperienceOrb extends Entity { +@@ -236,6 +297,7 @@ public class ExperienceOrb extends Entity { this.age = nbt.getShort("Age"); this.value = nbt.getShort("Value"); this.count = Math.max(nbt.getInt("Count"), 1); @@ -181,6 +183,19 @@ index 7c90063be2a7eb66b7f0981059018f20413256c6..37125ffe47fcd5fe93ab62ad8a46e818 } } +diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +index fe660bbaa4113fb2ffa1ea2f10e4e1e674fbb86d..bb6063ae7f4438916306ce876057f7488537b444 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java ++++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +@@ -274,7 +274,7 @@ public class Frog extends Animal { + this.getBrain().setMemory(MemoryModuleType.IS_PREGNANT, Unit.INSTANCE); + world.broadcastEntityEvent(this, (byte)18); + if (world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { +- world.addFreshEntity(new ExperienceOrb(world, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1)); ++ world.addFreshEntity(new ExperienceOrb(world, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, serverPlayer)); // Paper + } + + } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java index 0dff7a47ecac1916ad23739fbb06ddd0f0052a65..d0ebcc23d863be630b55245aa2604c108ee6c93a 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java diff --git a/patches/server/0167-PlayerPickupExperienceEvent.patch b/patches/server/0167-PlayerPickupExperienceEvent.patch index 6b3e21f67..f59d0999a 100644 --- a/patches/server/0167-PlayerPickupExperienceEvent.patch +++ b/patches/server/0167-PlayerPickupExperienceEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 227aca795efc99c4f81dfb30c00d31d2d7524542..6bf6d6629dfb9338d3e34f433a5698904a2acdad 100644 +index 16a1a005f2dda30cf804bf51638383ef3bfeb43e..80f4dfdbc410aa3346897e2ca63272a081712b6e 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -301,7 +301,7 @@ public class ExperienceOrb extends Entity { +@@ -303,7 +303,7 @@ public class ExperienceOrb extends Entity { @Override public void playerTouch(Player player) { if (!this.level.isClientSide) { diff --git a/patches/server/0235-MC-135506-Experience-should-save-as-Integers.patch b/patches/server/0235-MC-135506-Experience-should-save-as-Integers.patch index c0c7c171f..8248a48e4 100644 --- a/patches/server/0235-MC-135506-Experience-should-save-as-Integers.patch +++ b/patches/server/0235-MC-135506-Experience-should-save-as-Integers.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MC-135506: Experience should save as Integers diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 6bf6d6629dfb9338d3e34f433a5698904a2acdad..4848f26a006f4d4df620ded526134b3b39e90d29 100644 +index 80f4dfdbc410aa3346897e2ca63272a081712b6e..d6527396939d9a1dd2f1cfb6cb66dc64fa0e5332 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -284,7 +284,7 @@ public class ExperienceOrb extends Entity { +@@ -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); @@ -17,7 +17,7 @@ index 6bf6d6629dfb9338d3e34f433a5698904a2acdad..4848f26a006f4d4df620ded526134b3b nbt.putInt("Count", this.count); this.savePaperNBT(nbt); // Paper } -@@ -293,7 +293,7 @@ public class ExperienceOrb extends Entity { +@@ -295,7 +295,7 @@ public class ExperienceOrb extends Entity { public void readAdditionalSaveData(CompoundTag nbt) { this.health = nbt.getShort("Health"); this.age = nbt.getShort("Age");