From 496156e2eff4ec5a47aaf174cb1a04fd90612fde Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 13 Aug 2023 17:41:18 -0700 Subject: [PATCH] Update with latest upstream changes --- patches/api/0010-Timings-v2.patch | 14 +++---- patches/api/0081-PreCreatureSpawnEvent.patch | 8 ++-- ...hots-for-Timings-Tile-Entity-reports.patch | 4 +- patches/api/0154-PreSpawnerSpawnEvent.patch | 4 +- .../api/0183-Add-ThrownEggHatchEvent.patch | 10 ++--- patches/api/0197-Spawn-Reason-API.patch | 14 ++++--- patches/api/0208-Add-moon-phase-API.patch | 4 +- patches/api/0264-Expand-world-key-API.patch | 10 ++--- .../0296-Add-more-line-of-sight-methods.patch | 4 +- patches/api/0372-Collision-API.patch | 4 +- ...-Fix-SpawnEggMeta-get-setSpawnedType.patch | 6 +-- patches/server/0002-Remap-fixes.patch | 11 +----- patches/server/0009-MC-Utils.patch | 37 +------------------ patches/server/0013-Paper-Plugins.patch | 6 +-- patches/server/0014-Timings-v2.patch | 16 ++++---- .../0028-Implement-Paper-VersionChecker.patch | 4 +- .../server/0172-PreCreatureSpawnEvent.patch | 24 +++++------- .../server/0264-PreSpawnerSpawnEvent.patch | 8 ++-- .../0301-Entity-getEntitySpawnReason.patch | 4 +- .../0309-Mob-Spawner-API-Enhancements.patch | 8 ++-- ...Add-Raw-Byte-ItemStack-Serialization.patch | 4 +- ...ortation-and-cancel-velocity-if-tele.patch | 4 +- ...y-Counter-to-allow-plugins-to-use-va.patch | 4 +- ...ix-client-lag-on-advancement-loading.patch | 4 +- .../server/0570-Expand-world-key-API.patch | 6 +-- patches/server/0572-Item-Rarity-API.patch | 4 +- .../server/0576-Expose-protocol-version.patch | 4 +- .../0606-ItemStack-repair-check-API.patch | 4 +- ...76-Add-Raw-Byte-Entity-Serialization.patch | 4 +- ...-Fix-SpawnEggMeta-get-setSpawnedType.patch | 8 ++-- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 32 files changed, 102 insertions(+), 148 deletions(-) diff --git a/patches/api/0010-Timings-v2.patch b/patches/api/0010-Timings-v2.patch index 3b68a66eec..a5760e7af6 100644 --- a/patches/api/0010-Timings-v2.patch +++ b/patches/api/0010-Timings-v2.patch @@ -717,10 +717,10 @@ index 0000000000000000000000000000000000000000..199789d56d22fcb1b77ebd56805cc28a +} diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java new file mode 100644 -index 0000000000000000000000000000000000000000..0a0e6308923f466ca96786b74811b9beeca83d73 +index 0000000000000000000000000000000000000000..7213bd2ccf6fa03933a9dff878baee8e92bf50b9 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingHistory.java -@@ -0,0 +1,358 @@ +@@ -0,0 +1,356 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -749,7 +749,6 @@ index 0000000000000000000000000000000000000000..0a0e6308923f466ca96786b74811b9be +import co.aikar.timings.TimingHistory.RegionData.RegionId; +import com.google.common.base.Function; +import com.google.common.collect.Sets; -+ +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.World; @@ -768,7 +767,6 @@ index 0000000000000000000000000000000000000000..0a0e6308923f466ca96786b74811b9be +import java.util.Locale; +import java.util.Map; +import java.util.Set; -+ +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + @@ -871,7 +869,7 @@ index 0000000000000000000000000000000000000000..0a0e6308923f466ca96786b74811b9be + public JSONPair apply(Map.Entry entry) { + entityTypeSet.add(entry.getKey()); + return pair( -+ entry.getKey().getKey().getKey().toUpperCase(Locale.ROOT), ++ entry.getKey().getKey().getKey().toUpperCase(Locale.ENGLISH), + entry.getValue().count() + ); + } @@ -884,7 +882,7 @@ index 0000000000000000000000000000000000000000..0a0e6308923f466ca96786b74811b9be + public JSONPair apply(Map.Entry entry) { + tileEntityTypeSet.add(entry.getKey()); + return pair( -+ entry.getKey().getKey().getKey().toUpperCase(Locale.ROOT), ++ entry.getKey().getKey().getKey().toUpperCase(Locale.ENGLISH), + entry.getValue().count() + ); + } @@ -2857,7 +2855,7 @@ index 0000000000000000000000000000000000000000..3e61a926620a67daec3af54b72a1b911 + } +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index c0ba2c8d47bd6f149410b57e45fc87a3b3ad4aab..51b5ac9d535d1ecac7719deed2e422db442a1171 100644 +index 208825df2752c10caf2cf8fb860d5b25bdd429b2..e2f7f9ebed56f5d4ca23dafe313263b386121391 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -833,7 +833,6 @@ public final class Bukkit { @@ -2869,7 +2867,7 @@ index c0ba2c8d47bd6f149410b57e45fc87a3b3ad4aab..51b5ac9d535d1ecac7719deed2e422db /** diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 437d59ddf6a6859afc052257ba3f574929071522..c8a8305e41a55e98c99ed9df07f5763071a4485f 100644 +index 7aacf5c174dc66df0f605236ace5bcd2c5689a3b..520cbdb2cc7da4550e9346ebdfea0e80f32a49b6 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1819,6 +1819,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api/0081-PreCreatureSpawnEvent.patch b/patches/api/0081-PreCreatureSpawnEvent.patch index 3213ed0ab2..49aacd6c01 100644 --- a/patches/api/0081-PreCreatureSpawnEvent.patch +++ b/patches/api/0081-PreCreatureSpawnEvent.patch @@ -16,7 +16,7 @@ See: https://github.com/PaperMC/Paper/issues/917 diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3f2fdc9aa +index 0000000000000000000000000000000000000000..24b325625c76d0bc4cdb2f4063d6666aa3deac17 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java @@ -0,0 +1,105 @@ @@ -43,11 +43,11 @@ index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3 + */ +public class PreCreatureSpawnEvent extends Event implements Cancellable { + @NotNull private final Location location; -+ @NotNull private final EntityType type; ++ @NotNull private final EntityType type; + @NotNull private final CreatureSpawnEvent.SpawnReason reason; + private boolean shouldAbortSpawn; + -+ public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) { ++ public PreCreatureSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) { + this.location = Preconditions.checkNotNull(location, "Location may not be null"); + this.type = Preconditions.checkNotNull(type, "Type may not be null"); + this.reason = Preconditions.checkNotNull(reason, "Reason may not be null"); @@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..8b48759bf6f4fcef0847d9a2461993e3 + * @return The type of creature being spawned + */ + @NotNull -+ public EntityType getType() { ++ public EntityType getType() { + return type; + } + diff --git a/patches/api/0134-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch b/patches/api/0134-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch index 9e712f0a57..c9929551d8 100644 --- a/patches/api/0134-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch +++ b/patches/api/0134-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't use snapshots for Timings Tile Entity reports diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java -index 0a0e6308923f466ca96786b74811b9beeca83d73..e1b52eeecc1baf02c3e5d4bdf24ade769b2c3c75 100644 +index 7213bd2ccf6fa03933a9dff878baee8e92bf50b9..efcba8d9105e65f8770e95a20c9718ad93c6af79 100644 --- a/src/main/java/co/aikar/timings/TimingHistory.java +++ b/src/main/java/co/aikar/timings/TimingHistory.java -@@ -123,7 +123,7 @@ public class TimingHistory { +@@ -121,7 +121,7 @@ public class TimingHistory { data.entityCounts.get(entity.getType()).increment(); } diff --git a/patches/api/0154-PreSpawnerSpawnEvent.patch b/patches/api/0154-PreSpawnerSpawnEvent.patch index dcb362d8bc..8c49383326 100644 --- a/patches/api/0154-PreSpawnerSpawnEvent.patch +++ b/patches/api/0154-PreSpawnerSpawnEvent.patch @@ -12,7 +12,7 @@ Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..48cff063594840a07aeaf35513780e28ea019a76 +index 0000000000000000000000000000000000000000..765440cedcddc4a7b7312a930fef857efd7ad661 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java @@ -0,0 +1,29 @@ @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..48cff063594840a07aeaf35513780e28 +public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent { + @NotNull private final Location spawnerLocation; + -+ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) { ++ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) { + super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER); + this.spawnerLocation = Preconditions.checkNotNull(spawnerLocation, "Spawner location may not be null"); + } diff --git a/patches/api/0183-Add-ThrownEggHatchEvent.patch b/patches/api/0183-Add-ThrownEggHatchEvent.patch index f605a2a11b..9615a850ae 100644 --- a/patches/api/0183-Add-ThrownEggHatchEvent.patch +++ b/patches/api/0183-Add-ThrownEggHatchEvent.patch @@ -8,7 +8,7 @@ Adds a new event similar to PlayerEggThrowEvent, but without the Player requirem diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d380187c9c +index 0000000000000000000000000000000000000000..395f8da2d344cd036ceaee5dd39662e719df4e98 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java @@ -0,0 +1,115 @@ @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3 + private static final HandlerList handlers = new HandlerList(); + private final Egg egg; + private boolean hatching; -+ private EntityType hatchType; ++ private EntityType hatchType; + private byte numHatches; + -+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) { ++ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) { + this.egg = egg; + this.hatching = hatching; + this.numHatches = numHatches; @@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3 + * @return The type of the mob being hatched by the egg + */ + @NotNull -+ public EntityType getHatchingType() { ++ public EntityType getHatchingType() { + return hatchType; + } + @@ -84,7 +84,7 @@ index 0000000000000000000000000000000000000000..085d77dde83d6ed13eb83f23cf3e51d3 + * + * @param hatchType The type of the mob being hatched by the egg + */ -+ public void setHatchingType(@NotNull EntityType hatchType) { ++ public void setHatchingType(@NotNull EntityType hatchType) { + if (!hatchType.isSpawnable()) throw new IllegalArgumentException("Can't spawn that entity type from an egg!"); + this.hatchType = hatchType; + } diff --git a/patches/api/0197-Spawn-Reason-API.patch b/patches/api/0197-Spawn-Reason-API.patch index ff70668d2a..5c01ed0379 100644 --- a/patches/api/0197-Spawn-Reason-API.patch +++ b/patches/api/0197-Spawn-Reason-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Spawn Reason API diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 8264599a873ed23ec6552d1550a414ec3712487b..f53622413ecfb98b79bc59a397e1c7bd27951fb1 100644 +index 8264599a873ed23ec6552d1550a414ec3712487b..3806e420af559ddb26c567523b656c79a635b229 100644 --- a/src/main/java/org/bukkit/RegionAccessor.java +++ b/src/main/java/org/bukkit/RegionAccessor.java @@ -11,6 +11,7 @@ import org.bukkit.block.data.BlockData; @@ -16,7 +16,7 @@ index 8264599a873ed23ec6552d1550a414ec3712487b..f53622413ecfb98b79bc59a397e1c7bd import org.bukkit.util.Consumer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@@ -312,7 +313,34 @@ public interface RegionAccessor { +@@ -312,7 +313,36 @@ public interface RegionAccessor { * {@link Entity} requested cannot be spawned */ @NotNull @@ -37,13 +37,15 @@ index 8264599a873ed23ec6552d1550a414ec3712487b..f53622413ecfb98b79bc59a397e1c7bd + } + + @NotNull -+ public default Entity spawnEntity(@NotNull Location loc, @NotNull org.bukkit.entity.EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) { -+ return spawn(loc, (Class) type.getEntityClass(), reason, null); ++ public default Entity spawnEntity(@NotNull Location loc, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) { ++ com.google.common.base.Preconditions.checkArgument(type.getEntityClass() != null); ++ return spawn(loc, type.getEntityClass(), reason, null); + } + + @NotNull -+ public default Entity spawnEntity(@NotNull Location loc, @NotNull org.bukkit.entity.EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer function) { -+ return spawn(loc, (Class) type.getEntityClass(), reason, function); ++ public default Entity spawnEntity(@NotNull Location loc, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer function) { ++ com.google.common.base.Preconditions.checkArgument(type.getEntityClass() != null); ++ return spawn(loc, type.getEntityClass(), reason, function); + } + + @NotNull diff --git a/patches/api/0208-Add-moon-phase-API.patch b/patches/api/0208-Add-moon-phase-API.patch index 190c10f508..46af3aeb1d 100644 --- a/patches/api/0208-Add-moon-phase-API.patch +++ b/patches/api/0208-Add-moon-phase-API.patch @@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..df05153397b42930cd53d37b30824c7e + } +} diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index f53622413ecfb98b79bc59a397e1c7bd27951fb1..2349a935f87122bdda23c78142c810ed8ed80f4f 100644 +index 3806e420af559ddb26c567523b656c79a635b229..d039095a2c2f2c61b5596aa33e98e7cc95818678 100644 --- a/src/main/java/org/bukkit/RegionAccessor.java +++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -424,4 +424,12 @@ public interface RegionAccessor { +@@ -426,4 +426,12 @@ public interface RegionAccessor { * {@link HeightMap} */ public int getHighestBlockYAt(@NotNull Location location, @NotNull HeightMap heightMap); diff --git a/patches/api/0264-Expand-world-key-API.patch b/patches/api/0264-Expand-world-key-API.patch index 4e1b268119..cc9a885e83 100644 --- a/patches/api/0264-Expand-world-key-API.patch +++ b/patches/api/0264-Expand-world-key-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expand world key API diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 3d52f199c7635e0c89dd6540c7dc0fbf60177d1b..ebe6ba1f62a8538f5a1115248e87b80285368543 100644 +index dd7dd73b5c6da8a09c0cf227837919c80601a005..2efebdb38cbe768a186321a14f3a67f38682ca17 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -831,6 +831,18 @@ public final class Bukkit { @@ -28,7 +28,7 @@ index 3d52f199c7635e0c89dd6540c7dc0fbf60177d1b..ebe6ba1f62a8538f5a1115248e87b802 /** * Create a new virtual {@link WorldBorder}. diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 2349a935f87122bdda23c78142c810ed8ed80f4f..7c4cfc274ab7840d2474498b3e5d9251d6e731e9 100644 +index d039095a2c2f2c61b5596aa33e98e7cc95818678..fc7e604a7195259e8a91b461d25b65155adfcff0 100644 --- a/src/main/java/org/bukkit/RegionAccessor.java +++ b/src/main/java/org/bukkit/RegionAccessor.java @@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable; @@ -40,7 +40,7 @@ index 2349a935f87122bdda23c78142c810ed8ed80f4f..7c4cfc274ab7840d2474498b3e5d9251 /** * Gets the {@link Biome} at the given {@link Location}. -@@ -431,5 +431,14 @@ public interface RegionAccessor { +@@ -433,5 +433,14 @@ public interface RegionAccessor { */ @NotNull io.papermc.paper.world.MoonPhase getMoonPhase(); @@ -56,7 +56,7 @@ index 2349a935f87122bdda23c78142c810ed8ed80f4f..7c4cfc274ab7840d2474498b3e5d9251 // Paper end } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 94cccd613394b587c6df5b4feea354f883f83e50..3678de1b963dfb61de487b63ebf4dddd18ff8a34 100644 +index f2c66b23e9394cae680d29407226888ca3241b69..c59269a67b803ccc56acf376f14e9d8cb484cef3 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -695,6 +695,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -78,7 +78,7 @@ index 94cccd613394b587c6df5b4feea354f883f83e50..3678de1b963dfb61de487b63ebf4dddd * Create a new virtual {@link WorldBorder}. *

diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 29d3dccb81f48c6743c01cc875621257752ebea6..413085e6793a17762685198a5416cc3dfcc88995 100644 +index 97aa67b52903e5a13860048ba2937822cc771d21..c86bf2004e186e20d1cbc97c6d8efb04607a8fc7 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -146,5 +146,10 @@ public interface UnsafeValues { diff --git a/patches/api/0296-Add-more-line-of-sight-methods.patch b/patches/api/0296-Add-more-line-of-sight-methods.patch index 4a5b35d021..478085c5c3 100644 --- a/patches/api/0296-Add-more-line-of-sight-methods.patch +++ b/patches/api/0296-Add-more-line-of-sight-methods.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add more line of sight methods diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 7c4cfc274ab7840d2474498b3e5d9251d6e731e9..78396b7f754641de520f95d2015a9c6f1d933e7f 100644 +index fc7e604a7195259e8a91b461d25b65155adfcff0..d2316c9839b4bfc1ad34c9c8c46e7f66379d8f80 100644 --- a/src/main/java/org/bukkit/RegionAccessor.java +++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -440,5 +440,13 @@ public interface RegionAccessor extends Keyed { // Paper +@@ -442,5 +442,13 @@ public interface RegionAccessor extends Keyed { // Paper @NotNull @Override NamespacedKey getKey(); diff --git a/patches/api/0372-Collision-API.patch b/patches/api/0372-Collision-API.patch index 7fe1c8f8d9..48fce03393 100644 --- a/patches/api/0372-Collision-API.patch +++ b/patches/api/0372-Collision-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Collision API diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 9bfb26f13a0a8b36b8148769b8ce75368e7d4fe2..163c8b6abea291bcf2c7af9aca1e829a54e721e5 100644 +index b066f5ca236a182a6f9c9d0d1f3475a80ea9af76..f6c69331363a2f98a32f578a425c786d66dd7608 100644 --- a/src/main/java/org/bukkit/RegionAccessor.java +++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -472,5 +472,15 @@ public interface RegionAccessor extends Keyed { // Paper +@@ -474,5 +474,15 @@ public interface RegionAccessor extends Keyed { // Paper * @return whether a line of sight exists between {@code from} and {@code to} */ public boolean lineOfSightExists(@NotNull Location from, @NotNull Location to); diff --git a/patches/api/0409-Fix-SpawnEggMeta-get-setSpawnedType.patch b/patches/api/0409-Fix-SpawnEggMeta-get-setSpawnedType.patch index 4ea704f3f4..a63f180b39 100644 --- a/patches/api/0409-Fix-SpawnEggMeta-get-setSpawnedType.patch +++ b/patches/api/0409-Fix-SpawnEggMeta-get-setSpawnedType.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix SpawnEggMeta#get/setSpawnedType diff --git a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java -index 28a7544dddc05be0c5f9a7bad21b9d41029230bd..4dbaf178d6ea3e9ce9dc03e0f5aacc51be5af5c9 100644 +index 28a7544dddc05be0c5f9a7bad21b9d41029230bd..7892a23ec58f71b35b662bc08abacc6238a92b94 100644 --- a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java @@ -15,7 +15,7 @@ public interface SpawnEggMeta extends ItemMeta { @@ -32,14 +32,14 @@ index 28a7544dddc05be0c5f9a7bad21b9d41029230bd..4dbaf178d6ea3e9ce9dc03e0f5aacc51 + * + * @return the entity type or null if no custom type is set + */ -+ @org.jetbrains.annotations.Nullable EntityType getCustomSpawnedType(); ++ @org.jetbrains.annotations.Nullable EntityType getCustomSpawnedType(); + + /** + * Set the custom type of entity this egg will spawn. + * + * @param type the entity type or null to clear the custom type + */ -+ void setCustomSpawnedType(@org.jetbrains.annotations.Nullable EntityType type); ++ void setCustomSpawnedType(@org.jetbrains.annotations.Nullable EntityType type); + // Paper end + @NotNull diff --git a/patches/server/0002-Remap-fixes.patch b/patches/server/0002-Remap-fixes.patch index fc4f1507e0..52727ae47e 100644 --- a/patches/server/0002-Remap-fixes.patch +++ b/patches/server/0002-Remap-fixes.patch @@ -104,7 +104,7 @@ index ad52c3fc6210939a39ef77a382c640a24ee44838..6b7dd01778f0a5d3a96d2d04af4b525d } } diff --git a/src/test/java/org/bukkit/RegistryConstantsTest.java b/src/test/java/org/bukkit/RegistryConstantsTest.java -index 569aa9caac8407b52214dbec564dc8e9f08cacc9..c20fc9466649f16f1102978590780bb729c55bc9 100644 +index 179c56181b4f1a8b3b138248450e31b0c7816f97..c4cf1462c2d4d4dd969fb1ff82c2ba441497eeff 100644 --- a/src/test/java/org/bukkit/RegistryConstantsTest.java +++ b/src/test/java/org/bukkit/RegistryConstantsTest.java @@ -4,7 +4,7 @@ import java.lang.reflect.Field; @@ -132,15 +132,6 @@ index 569aa9caac8407b52214dbec564dc8e9f08cacc9..c20fc9466649f16f1102978590780bb7 this.testMissingConstants(TrimPattern.class, Registries.TRIM_PATTERN); } -@@ -169,7 +169,7 @@ public class RegistryConstantsTest extends AbstractTestingBase { - this.testMissingConstants(MusicInstrument.class, Registries.INSTRUMENT); - } - -- private void testExcessConstants(Class clazz, Registry registry) { -+ private void testExcessConstants(Class clazz, Registry registry) { // Paper - remap fix - List excessKeys = new ArrayList<>(); - - for (Field field : clazz.getFields()) { @@ -198,10 +198,10 @@ public class RegistryConstantsTest extends AbstractTestingBase { Assert.assertTrue(excessKeys.size() + " excess constants(s) in " + clazz.getSimpleName() + " that do not exist: " + excessKeys, excessKeys.isEmpty()); } diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 6419eaf2c2..93316510a8 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -7628,43 +7628,10 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 6bd320b6742f614ebc589c44ad4cbcfa099bcd4e..d31cf9cc09e5d92f62ee8ea545f53a0c79952479 100644 +index 6bd320b6742f614ebc589c44ad4cbcfa099bcd4e..cadb7bc5cb029075326c7c97457fd82c6d37ebb8 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -117,8 +117,17 @@ public final class CraftMagicNumbers implements UnsafeValues { - private static final Map ITEM_MATERIAL = new HashMap<>(); - private static final Map MATERIAL_ITEM = new HashMap<>(); - private static final Map MATERIAL_BLOCK = new HashMap<>(); -+ // Paper start -+ private static final Map> ENTITY_TYPE_ENTITY_TYPES = new HashMap<>(); -+ private static final Map, org.bukkit.entity.EntityType> ENTITY_TYPES_ENTITY_TYPE = new HashMap<>(); - - static { -+ for (org.bukkit.entity.EntityType type : org.bukkit.entity.EntityType.values()) { -+ if (type == org.bukkit.entity.EntityType.UNKNOWN) continue; -+ ENTITY_TYPE_ENTITY_TYPES.put(type, net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))); -+ ENTITY_TYPES_ENTITY_TYPE.put(net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())), type); -+ } -+ // Paper end - for (Block block : CraftRegistry.getMinecraftRegistry().registryOrThrow(Registries.BLOCK)) { - BLOCK_MATERIAL.put(block, Material.getMaterial(CraftRegistry.getMinecraftRegistry().registryOrThrow(Registries.BLOCK).getKey(block).getPath().toUpperCase(Locale.ROOT))); - } -@@ -173,6 +182,14 @@ public final class CraftMagicNumbers implements UnsafeValues { - public static ResourceLocation key(Material mat) { - return CraftNamespacedKey.toMinecraft(mat.getKey()); - } -+ // Paper start -+ public static net.minecraft.world.entity.EntityType getEntityTypes(org.bukkit.entity.EntityType type) { -+ return ENTITY_TYPE_ENTITY_TYPES.get(type); -+ } -+ public static org.bukkit.entity.EntityType getEntityType(net.minecraft.world.entity.EntityType entityTypes) { -+ return ENTITY_TYPES_ENTITY_TYPE.get(entityTypes); -+ } -+ // Paper end - // ======================================================================== - - public static byte toLegacyData(BlockState data) { -@@ -209,6 +226,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -209,6 +209,13 @@ public final class CraftMagicNumbers implements UnsafeValues { return material; } diff --git a/patches/server/0013-Paper-Plugins.patch b/patches/server/0013-Paper-Plugins.patch index 535c1f5d0a..894acba289 100644 --- a/patches/server/0013-Paper-Plugins.patch +++ b/patches/server/0013-Paper-Plugins.patch @@ -6973,7 +6973,7 @@ index 35e7f8e7b19c217fa5f3f55abb0f8b9cd6b16f18..72c2f0bf9434e09a0dd51294d3a2200f Bootstrap.validate(); Util.startTimerHackThread(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1a4073822fe782c7b99710e8ef63051857a6adcf..d8fc6953eded8567273c11bc52a3342702ccc70d 100644 +index ed6b27c58953f2fa783d3078f89196d26cc7ad10..3efc900fdd063be7e47d9337a9ff5d1bb8e8cde2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -267,7 +267,8 @@ public final class CraftServer implements Server { @@ -7062,10 +7062,10 @@ index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7 @Override public FileConfiguration getConfig() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 14540be85e1ff2c231a4bed4b7a2c2d7df50516a..c99bdd2092e3f1aa7391ab743f027813c9189e70 100644 +index 0be076544e03777811c1473237d09a6b9e9d3c99..6042a998cd67b5089651a78c70a7f6a9beb74b00 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -496,6 +496,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -479,6 +479,12 @@ public final class CraftMagicNumbers implements UnsafeValues { return this.customBiome; } diff --git a/patches/server/0014-Timings-v2.patch b/patches/server/0014-Timings-v2.patch index f31f044c6e..3c58c0e7c2 100644 --- a/patches/server/0014-Timings-v2.patch +++ b/patches/server/0014-Timings-v2.patch @@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..59affb62cb487d60e8c3e32decf89d6c +} diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java new file mode 100644 -index 0000000000000000000000000000000000000000..12fde004221de66cf1c0f0de1fbcee1ac3b5732d +index 0000000000000000000000000000000000000000..90c343a97a4d13165ff2837b3888243dd99772ca --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingsExport.java @@ -0,0 +1,387 @@ @@ -404,9 +404,9 @@ index 0000000000000000000000000000000000000000..12fde004221de66cf1c0f0de1fbcee1a + pair("handlers", handlers), + pair("worlds", toObjectMapper(TimingHistory.worldMap.entrySet(), input -> pair(input.getValue(), input.getKey()))), + pair("tileentity", -+ toObjectMapper(tileEntityTypeSet, input -> pair(input.getKey().getKey().toUpperCase(Locale.ROOT), input.getKey().getKey().toUpperCase(Locale.ROOT)))), ++ toObjectMapper(tileEntityTypeSet, input -> pair(input.getKey().getKey().toUpperCase(Locale.ENGLISH), input.getKey().getKey().toUpperCase(Locale.ENGLISH)))), + pair("entity", -+ toObjectMapper(entityTypeSet, input -> pair(input.getKey().getKey().toUpperCase(Locale.ROOT), input.getKey().getKey().toUpperCase(Locale.ROOT)))) ++ toObjectMapper(entityTypeSet, input -> pair(input.getKey().getKey().toUpperCase(Locale.ENGLISH), input.getKey().getKey().toUpperCase(Locale.ENGLISH)))) + )); + + // Information about loaded plugins @@ -1633,7 +1633,7 @@ index 0eb09ce5c850d85ffd7229d27cf06b3e0edda11b..cc1d7626a82881c4410d65c6a33dadae }; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d8fc6953eded8567273c11bc52a3342702ccc70d..d3f1561be9221c0b42ac77de1fcc6bf5058cde1a 100644 +index 3efc900fdd063be7e47d9337a9ff5d1bb8e8cde2..667cb2168b1f42611a4715fbe723d7ba1ee4c025 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -362,7 +362,7 @@ public final class CraftServer implements Server { @@ -2047,12 +2047,12 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222 + } // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index c99bdd2092e3f1aa7391ab743f027813c9189e70..e1477d5ec704d255ad3ffdda82ae9f3df5fcd80a 100644 +index 6042a998cd67b5089651a78c70a7f6a9beb74b00..cb856a5f8c01fe08d08705ef690ca8639a82b5f0 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -228,6 +228,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -211,6 +211,12 @@ public final class CraftMagicNumbers implements UnsafeValues { + return CraftNamespacedKey.toMinecraft(mat.getKey()); } - // Paper end // ======================================================================== + // Paper start + @Override @@ -2063,7 +2063,7 @@ index c99bdd2092e3f1aa7391ab743f027813c9189e70..e1477d5ec704d255ad3ffdda82ae9f3d public static byte toLegacyData(BlockState data) { return CraftLegacy.toLegacyData(data); -@@ -509,6 +515,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -492,6 +498,13 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftFeatureFlag.getFromNMS(namespacedKey); } diff --git a/patches/server/0028-Implement-Paper-VersionChecker.patch b/patches/server/0028-Implement-Paper-VersionChecker.patch index c729ea25f5..716765dc06 100644 --- a/patches/server/0028-Implement-Paper-VersionChecker.patch +++ b/patches/server/0028-Implement-Paper-VersionChecker.patch @@ -140,10 +140,10 @@ index 0000000000000000000000000000000000000000..22a55be34fde453fedd987173d95b8b3 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e1477d5ec704d255ad3ffdda82ae9f3df5fcd80a..621e63a2ef0623b81140efc5abe84a2450bd3e05 100644 +index cb856a5f8c01fe08d08705ef690ca8639a82b5f0..1d2c587d231bde66f56804e92a538a83e91bc3d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -520,6 +520,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -503,6 +503,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getTimingsServerName() { return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; } diff --git a/patches/server/0172-PreCreatureSpawnEvent.patch b/patches/server/0172-PreCreatureSpawnEvent.patch index 4da8e04bb8..4646aa1ae5 100644 --- a/patches/server/0172-PreCreatureSpawnEvent.patch +++ b/patches/server/0172-PreCreatureSpawnEvent.patch @@ -15,7 +15,7 @@ instead and save a lot of server resources. See: https://github.com/PaperMC/Paper/issues/917 diff --git a/src/main/java/net/minecraft/util/SpawnUtil.java b/src/main/java/net/minecraft/util/SpawnUtil.java -index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef22710b5bc83 100644 +index b77ebe04f1018962b85110258c8a0a2db8612485..cde7244f64697e6fdc27a02937f89667ff0e609e 100644 --- a/src/main/java/net/minecraft/util/SpawnUtil.java +++ b/src/main/java/net/minecraft/util/SpawnUtil.java @@ -22,10 +22,10 @@ public class SpawnUtil { @@ -31,13 +31,12 @@ index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef227 // CraftBukkit end BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable(); -@@ -35,6 +35,26 @@ public class SpawnUtil { +@@ -35,6 +35,25 @@ public class SpawnUtil { blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1); if (worldserver.getWorldBorder().isWithinBounds((BlockPos) blockposition_mutableblockposition) && SpawnUtil.moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) { + // Paper start -+ String key = EntityType.getKey(entitytypes).getPath(); -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); ++ org.bukkit.entity.EntityType type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(entitytypes); + + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; + event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( @@ -59,7 +58,7 @@ index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef227 if (t0 != null) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 93a43ef867d0961b46f9ecadc2c7be6a4b17c72b..c2aafe4e1afec2793735bf7b0bbd6af94ad393f8 100644 +index 93a43ef867d0961b46f9ecadc2c7be6a4b17c72b..539ad181edd4a9ef231cf9110cbb1140b06f8e67 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -413,6 +413,20 @@ public class EntityType implements FeatureElement, EntityTypeT @@ -67,7 +66,7 @@ index 93a43ef867d0961b46f9ecadc2c7be6a4b17c72b..c2aafe4e1afec2793735bf7b0bbd6af9 public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Consumer consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { // CraftBukkit end + // Paper start - Call PreCreatureSpawnEvent -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(this).getPath()); ++ org.bukkit.entity.EntityType type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(this); + if (type != null) { + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; + event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( @@ -97,18 +96,15 @@ index 68594d2621267f4b112b4d14d2bec3a0dd6a044a..73a5750dd47cf8869070f92594cfb926 } } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 20c39481bcf05e0d43c97b7e841ec9f5f6a0d45d..fc7719d12b5f6011aec2e41a36b4bacd77672b6d 100644 +index 20c39481bcf05e0d43c97b7e841ec9f5f6a0d45d..a53b16b7bc640acfc2c8a5a86ad177d9c076d7b3 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -128,6 +128,27 @@ public abstract class BaseSpawner { +@@ -128,6 +128,24 @@ public abstract class BaseSpawner { } else if (!SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) { continue; } + // Paper start -+ EntityType entityType = optional.get(); -+ String key = EntityType.getKey(entityType).getPath(); -+ -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); ++ org.bukkit.entity.EntityType type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(optional.get()); + if (type != null) { + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; + event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( @@ -129,7 +125,7 @@ index 20c39481bcf05e0d43c97b7e841ec9f5f6a0d45d..fc7719d12b5f6011aec2e41a36b4bacd Entity entity = EntityType.loadEntityRecursive(nbttagcompound, world, (entity1) -> { entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot()); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index b2bb9bbd3af414c50ec3f8e3e171a679e95ef75e..5338e0e1a67925da0c386735a545bb31096afbb1 100644 +index b2bb9bbd3af414c50ec3f8e3e171a679e95ef75e..44cf7eb6458f5ee9ae55dee479d7847d451d85d1 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -213,7 +213,13 @@ public final class NaturalSpawner { @@ -157,7 +153,7 @@ index b2bb9bbd3af414c50ec3f8e3e171a679e95ef75e..5338e0e1a67925da0c386735a545bb31 + // Paper start + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(entitytypes).getPath()); ++ org.bukkit.entity.EntityType type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(entitytypes); + if (type != null) { + event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( + io.papermc.paper.util.MCUtil.toLocation(world, pos), diff --git a/patches/server/0264-PreSpawnerSpawnEvent.patch b/patches/server/0264-PreSpawnerSpawnEvent.patch index f9634b126c..c7e6f02b9b 100644 --- a/patches/server/0264-PreSpawnerSpawnEvent.patch +++ b/patches/server/0264-PreSpawnerSpawnEvent.patch @@ -9,12 +9,12 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for spawners. diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index fc7719d12b5f6011aec2e41a36b4bacd77672b6d..a9be524edb03c51300bc45d424fcf87c7491a8c0 100644 +index a53b16b7bc640acfc2c8a5a86ad177d9c076d7b3..0af2d9420ec6c454970ac89b74676585010d11e9 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -134,11 +134,11 @@ public abstract class BaseSpawner { - - org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); +@@ -131,11 +131,11 @@ public abstract class BaseSpawner { + // Paper start + org.bukkit.entity.EntityType type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(optional.get()); if (type != null) { - com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; - event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( diff --git a/patches/server/0301-Entity-getEntitySpawnReason.patch b/patches/server/0301-Entity-getEntitySpawnReason.patch index 3565f02584..bea69f8ae7 100644 --- a/patches/server/0301-Entity-getEntitySpawnReason.patch +++ b/patches/server/0301-Entity-getEntitySpawnReason.patch @@ -96,10 +96,10 @@ index 9780ebabd27def10b09deebc5be2043d063de9f3..7be82f903e5f65d00b68dc7ee7c1cb4b } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index a9be524edb03c51300bc45d424fcf87c7491a8c0..a08c2dee792da1a54005f0a65a9eefabc7bc7c60 100644 +index 0af2d9420ec6c454970ac89b74676585010d11e9..b0ae290342b4f540b77a928b19a86dd61166b210 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -187,6 +187,7 @@ public abstract class BaseSpawner { +@@ -184,6 +184,7 @@ public abstract class BaseSpawner { } entity.spawnedViaMobSpawner = true; // Paper diff --git a/patches/server/0309-Mob-Spawner-API-Enhancements.patch b/patches/server/0309-Mob-Spawner-API-Enhancements.patch index c4a49e0b4d..03c674a622 100644 --- a/patches/server/0309-Mob-Spawner-API-Enhancements.patch +++ b/patches/server/0309-Mob-Spawner-API-Enhancements.patch @@ -9,10 +9,10 @@ public net.minecraft.world.level.BaseSpawner delay(Lnet/minecraft/world/level/Le public net.minecraft.world.level.BaseSpawner setNextSpawnData(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/SpawnData;)V diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index a08c2dee792da1a54005f0a65a9eefabc7bc7c60..369298dfd437c1c83801f3d4ba63484ee1b969fe 100644 +index b0ae290342b4f540b77a928b19a86dd61166b210..3f70734857e0fe15e0c3f26253fcff61bad8db7f 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -233,7 +233,13 @@ public abstract class BaseSpawner { +@@ -230,7 +230,13 @@ public abstract class BaseSpawner { } public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) { @@ -26,7 +26,7 @@ index a08c2dee792da1a54005f0a65a9eefabc7bc7c60..369298dfd437c1c83801f3d4ba63484e boolean flag = nbt.contains("SpawnData", 10); if (flag) { -@@ -256,9 +262,15 @@ public abstract class BaseSpawner { +@@ -253,9 +259,15 @@ public abstract class BaseSpawner { this.spawnPotentials = SimpleWeightedRandomList.single(this.nextSpawnData != null ? this.nextSpawnData : new SpawnData()); } @@ -44,7 +44,7 @@ index a08c2dee792da1a54005f0a65a9eefabc7bc7c60..369298dfd437c1c83801f3d4ba63484e this.spawnCount = nbt.getShort("SpawnCount"); } -@@ -275,9 +287,20 @@ public abstract class BaseSpawner { +@@ -272,9 +284,20 @@ public abstract class BaseSpawner { } public CompoundTag save(CompoundTag nbt) { diff --git a/patches/server/0361-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/server/0361-Add-Raw-Byte-ItemStack-Serialization.patch index 28482b8a06..8a05260f31 100644 --- a/patches/server/0361-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/server/0361-Add-Raw-Byte-ItemStack-Serialization.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 621e63a2ef0623b81140efc5abe84a2450bd3e05..34555953d4252ef4c61d6901a9d33e2eded0f404 100644 +index 1d2c587d231bde66f56804e92a538a83e91bc3d7..948d46be039ec0c891ef919aa5576b78658d1142 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -525,6 +525,52 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -508,6 +508,52 @@ public final class CraftMagicNumbers implements UnsafeValues { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { return new com.destroystokyo.paper.PaperVersionFetcher(); } diff --git a/patches/server/0465-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/0465-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index feae3c7f54..13969fdbb1 100644 --- a/patches/server/0465-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/0465-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -57,10 +57,10 @@ index 5a1959a16070a49e935bfd7a43fbf3fabdd2b1e6..11675a7611a42277ed0625509aa98a2f this.setYRot(yaw); this.setXRot(pitch); diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 369298dfd437c1c83801f3d4ba63484ee1b969fe..ae2b95f53e875716489821dc9b0a3a35039bfcc9 100644 +index 3f70734857e0fe15e0c3f26253fcff61bad8db7f..3dd97f489f2d792d97b23526bfab67fb150e5c95 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -167,6 +167,7 @@ public abstract class BaseSpawner { +@@ -164,6 +164,7 @@ public abstract class BaseSpawner { return; } diff --git a/patches/server/0469-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0469-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 43d8351dc7..e9e3c7367c 100644 --- a/patches/server/0469-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0469-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -21,10 +21,10 @@ index 11675a7611a42277ed0625509aa98a2f69611698..bda94c9c34c7f1f6b56103de5be253c6 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 34555953d4252ef4c61d6901a9d33e2eded0f404..e74459da98dfa5bf790629e450ed51d1f97f8d34 100644 +index 948d46be039ec0c891ef919aa5576b78658d1142..ba82ebc3257fce664913ea86eff2b71cf4680351 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -571,6 +571,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -554,6 +554,11 @@ public final class CraftMagicNumbers implements UnsafeValues { Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); return compound; } diff --git a/patches/server/0487-Fix-client-lag-on-advancement-loading.patch b/patches/server/0487-Fix-client-lag-on-advancement-loading.patch index 363706917e..159ce1570d 100644 --- a/patches/server/0487-Fix-client-lag-on-advancement-loading.patch +++ b/patches/server/0487-Fix-client-lag-on-advancement-loading.patch @@ -15,10 +15,10 @@ manually reload the advancement data for all players, which normally takes place as a part of the datapack reloading. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e74459da98dfa5bf790629e450ed51d1f97f8d34..227279ae3d4aa1aadd961e07986b94b1b5786fd7 100644 +index ba82ebc3257fce664913ea86eff2b71cf4680351..684701f506555c745896ac0803ebb109778150f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -371,7 +371,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -354,7 +354,13 @@ public final class CraftMagicNumbers implements UnsafeValues { Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex); } diff --git a/patches/server/0570-Expand-world-key-API.patch b/patches/server/0570-Expand-world-key-API.patch index 7b23e2a0ef..3c7ef6246e 100644 --- a/patches/server/0570-Expand-world-key-API.patch +++ b/patches/server/0570-Expand-world-key-API.patch @@ -20,7 +20,7 @@ index f302d936057a56629c4b9edaaffb996191b102c9..ff7d2bfbd94cd336fccd70dde904df56 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index db932b5fe59b29969f199003dc32248f4253c1a2..ef0bc987da9bd076fd1f760c0c9ba4c1db57e771 100644 +index 8559ca8981de611eb9e96375295725c571f46834..47db5db470bda919c98d845b0c1338d3c3f60bc9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1164,9 +1164,15 @@ public final class CraftServer implements Server { @@ -67,10 +67,10 @@ index db932b5fe59b29969f199003dc32248f4253c1a2..ef0bc987da9bd076fd1f760c0c9ba4c1 // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 227279ae3d4aa1aadd961e07986b94b1b5786fd7..6c454ec27082f04d4e6b74d718dd1e333e4b2f14 100644 +index 684701f506555c745896ac0803ebb109778150f5..4d776afaf8dce0e9dcd4b3992373680d86cc67f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -582,6 +582,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -565,6 +565,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public int nextEntityId() { return net.minecraft.world.entity.Entity.nextEntityId(); } diff --git a/patches/server/0572-Item-Rarity-API.patch b/patches/server/0572-Item-Rarity-API.patch index b691abcce6..0aa73266cd 100644 --- a/patches/server/0572-Item-Rarity-API.patch +++ b/patches/server/0572-Item-Rarity-API.patch @@ -23,10 +23,10 @@ index 49be8074280d9840bb3d8e6880b4e0a8aa4ef0cb..589e8816a49f7d5cb6c4231e58513196 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 6c454ec27082f04d4e6b74d718dd1e333e4b2f14..9f395fd7a38d2589269eeea00efd6dcada290088 100644 +index 4d776afaf8dce0e9dcd4b3992373680d86cc67f5..7807d0bf54cf55703a96ff5d55f335ff786048b7 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -587,6 +587,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -570,6 +570,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getMainLevelName() { return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName; } diff --git a/patches/server/0576-Expose-protocol-version.patch b/patches/server/0576-Expose-protocol-version.patch index be6b353cef..423e5569eb 100644 --- a/patches/server/0576-Expose-protocol-version.patch +++ b/patches/server/0576-Expose-protocol-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 9f395fd7a38d2589269eeea00efd6dcada290088..2944ca24702bb5b8a3c548f5fda872ddb44e7573 100644 +index 7807d0bf54cf55703a96ff5d55f335ff786048b7..e71b4d76971a195224b74ffae9b235a1f47b445e 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -592,6 +592,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -575,6 +575,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) { return io.papermc.paper.inventory.ItemRarity.values()[((org.bukkit.craftbukkit.inventory.CraftItemType)itemStack.getType()).getHandle().getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; } diff --git a/patches/server/0606-ItemStack-repair-check-API.patch b/patches/server/0606-ItemStack-repair-check-API.patch index 68b8b54df0..edd2b18afe 100644 --- a/patches/server/0606-ItemStack-repair-check-API.patch +++ b/patches/server/0606-ItemStack-repair-check-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 2944ca24702bb5b8a3c548f5fda872ddb44e7573..d59368cc5d280935da1aac1d9322583527e8742d 100644 +index e71b4d76971a195224b74ffae9b235a1f47b445e..a2b579b5c87294a21b354cb6abcc439b5ca7bcc9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -593,6 +593,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -576,6 +576,11 @@ public final class CraftMagicNumbers implements UnsafeValues { return io.papermc.paper.inventory.ItemRarity.values()[((org.bukkit.craftbukkit.inventory.CraftItemType)itemStack.getType()).getHandle().getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; } diff --git a/patches/server/0676-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0676-Add-Raw-Byte-Entity-Serialization.patch index ac9056737b..0d355c0e92 100644 --- a/patches/server/0676-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0676-Add-Raw-Byte-Entity-Serialization.patch @@ -47,10 +47,10 @@ index ec2c989f690020cd9959fac877bae0a0263872fa..594b5e0fd56eb92ebcb0ea5a6ccdb3ba // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index d59368cc5d280935da1aac1d9322583527e8742d..ab3e0782720359b9825a636c5fdf8725c66687bf 100644 +index a2b579b5c87294a21b354cb6abcc439b5ca7bcc9..49cff434c18a92dff6bb2f8f40634780263e6cda 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -550,6 +550,29 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -533,6 +533,29 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of(ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ITEM_STACK, compound, dataVersion, getDataVersion()))); } diff --git a/patches/server/0940-Fix-SpawnEggMeta-get-setSpawnedType.patch b/patches/server/0940-Fix-SpawnEggMeta-get-setSpawnedType.patch index 5eff519db0..4d26a59da4 100644 --- a/patches/server/0940-Fix-SpawnEggMeta-get-setSpawnedType.patch +++ b/patches/server/0940-Fix-SpawnEggMeta-get-setSpawnedType.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix SpawnEggMeta#get/setSpawnedType diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java -index 7899af2b01112a7a8934fdae7c9f3a6854d1daa8..49fea9cea6c3be3be0313c2a1cf49118e95d0698 100644 +index 7899af2b01112a7a8934fdae7c9f3a6854d1daa8..ffc1bfa977a25c238418874c9cd87aad52518dad 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java @@ -217,6 +217,31 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta { @@ -14,16 +14,16 @@ index 7899af2b01112a7a8934fdae7c9f3a6854d1daa8..49fea9cea6c3be3be0313c2a1cf49118 + // Paper start + @Override -+ public EntityType getCustomSpawnedType() { ++ public EntityType getCustomSpawnedType() { + return java.util.Optional.ofNullable(this.entityTag) + .map(tag -> tag.getString(ENTITY_ID.NBT)) + .flatMap(net.minecraft.world.entity.EntityType::byString) -+ .map(org.bukkit.craftbukkit.util.CraftMagicNumbers::getEntityType) ++ .map(org.bukkit.craftbukkit.entity.CraftEntityType::minecraftToBukkit) + .orElse(null); + } + + @Override -+ public void setCustomSpawnedType(final EntityType type) { ++ public void setCustomSpawnedType(final EntityType type) { + if (type == null) { + if (this.entityTag != null) { + this.entityTag.remove(ENTITY_ID.NBT); diff --git a/work/Bukkit b/work/Bukkit index 6680169e93..8a4d59aab1 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 6680169e93a66de553b307018679b3f6421a1061 +Subproject commit 8a4d59aab12ac2615078c437e2661ba808232866 diff --git a/work/CraftBukkit b/work/CraftBukkit index 8969b32d06..98fef86cf7 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 8969b32d068e0046bf5ceaacf8754cd6855d6296 +Subproject commit 98fef86cf7ddf79408fd6cfbd586fad66538f4cc