diff --git a/patches/server/0002-Remap-fixes.patch b/patches/server/0002-Remap-fixes.patch index 7a8fe260cd..7e65e3c2eb 100644 --- a/patches/server/0002-Remap-fixes.patch +++ b/patches/server/0002-Remap-fixes.patch @@ -41,6 +41,21 @@ index 954cf20fb9fbf331fe6314590a3edbe73118ceca..d4c46f44f7a998121482c2fc56d79868 } } +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index 8191d7f243aa10f8535b5f99ac309c1780acdcde..773638011f8ece0663d2ba891071124ab1122b0d 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -1419,9 +1419,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + LevelChunk chunk1; + + if (chunk instanceof LevelChunk) { +- LevelChunk chunk1 = (LevelChunk) chunk; +- +- chunk1 = chunk1; ++ chunk1 = (LevelChunk) chunk; // Paper - remap fix + } else { + chunk1 = this.level.getChunk(chunkcoordintpair.x, chunkcoordintpair.z); + } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java index 8f0a2f8d3a34c6b97bc7a933272ccf2689576c76..b9fcff8862e624644fdb73afcb3ef2106b0a76fc 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java diff --git a/patches/server/0008-MC-Utils.patch b/patches/server/0008-MC-Utils.patch index 9972016e0c..2ee8ad33f2 100644 --- a/patches/server/0008-MC-Utils.patch +++ b/patches/server/0008-MC-Utils.patch @@ -5793,7 +5793,7 @@ index f902b1f7062fc2c81e0ce43e8b8599192469e57c..74d1ae0104e8d0795df50f00317fd860 + // Paper end } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 8191d7f243aa10f8535b5f99ac309c1780acdcde..77ff6d46a4361ae1b377fa3cb269c75467a45f01 100644 +index 773638011f8ece0663d2ba891071124ab1122b0d..bd9d6f7721994780b70dff22319614bc67bbf276 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -65,6 +65,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket; @@ -6050,7 +6050,7 @@ index 8191d7f243aa10f8535b5f99ac309c1780acdcde..77ff6d46a4361ae1b377fa3cb269c754 } @Override -@@ -1504,7 +1584,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1502,7 +1582,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private class ChunkDistanceManager extends DistanceManager { protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) { @@ -6523,7 +6523,7 @@ index 9908ab936780a88992c2690502c85e4d9074371d..017e0ae318c15cfce72ed389b2503454 public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // Holder holder = worlddimension.type(); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 9f840f4d1459cc66c6a7ca865dbfbd89289b31cb..9bd9210c3c66d9fa9085cfadb943e1dc93820697 100644 +index 957e816429fdf1ab5e3f4431a3d19340cccea837..48972d64710fb0d3821e7c1a0722a1d203c47e07 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -247,6 +247,8 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0014-Starlight.patch b/patches/server/0014-Starlight.patch index e5d19e39f6..39eeedccec 100644 --- a/patches/server/0014-Starlight.patch +++ b/patches/server/0014-Starlight.patch @@ -4485,7 +4485,7 @@ index 74d1ae0104e8d0795df50f00317fd860de4f112e..a7feddc31da0870faa3d32a7108282e9 private final DebugBuffer chunkToSaveHistory; public int oldTicketLevel; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index fc5965f8f2ac21a8465285e5933d8490b015568d..ecb5a18874509341dd691b290ea7d1f8c17e0bd7 100644 +index 4aaea477933a89c0febdcfedeebeae609e61f73e..779783037d024792f8052fea0ea8dbe6f06bc181 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -131,7 +131,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -4911,7 +4911,7 @@ index 3fdbb777d4722596cc4df79b2d4d7b9c553580fd..1b7496cec0ba5a95615a069e3168bd46 public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry biome, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) { this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -index f4aab0bf544ef5c889c02e41389b1656cf1e4932..bf66cdb94daa6657e9415adfa16d16983b258ee3 100644 +index f4aab0bf544ef5c889c02e41389b1656cf1e4932..e2278ed457a7342d0d1b1a5fc1b5bdef6358816b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java @@ -293,6 +293,17 @@ public class ChunkStatus { @@ -4923,7 +4923,7 @@ index f4aab0bf544ef5c889c02e41389b1656cf1e4932..bf66cdb94daa6657e9415adfa16d1698 + try { + // We need this otherwise we return EMPTY for invalid names + ResourceLocation key = new ResourceLocation(name); -+ return Registry.CHUNK_STATUS.getOptional(key).orElse(null); ++ return BuiltInRegistries.CHUNK_STATUS.getOptional(key).orElse(null); + } catch (Exception ex) { + return null; // invalid name + } diff --git a/patches/server/0016-Rewrite-chunk-system.patch b/patches/server/0016-Rewrite-chunk-system.patch index 334a3e09ca..59ab9515e2 100644 --- a/patches/server/0016-Rewrite-chunk-system.patch +++ b/patches/server/0016-Rewrite-chunk-system.patch @@ -2675,7 +2675,7 @@ index 8a5e93961dac4d87c81c0e70b6f4124a1f1d2556..0dc94dec1317b3f86d38074c6cbe41ab private ChunkSystem() { diff --git a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java new file mode 100644 -index 0000000000000000000000000000000000000000..c37adf64ad6133a8d79bfad4a852a6a7e284b6d3 +index 0000000000000000000000000000000000000000..61c170555c8854b102c640b0b6a615f9f732edbf --- /dev/null +++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java @@ -0,0 +1,839 @@ @@ -2693,8 +2693,8 @@ index 0000000000000000000000000000000000000000..c37adf64ad6133a8d79bfad4a852a6a7 +import net.minecraft.core.BlockPos; +import io.papermc.paper.chunk.system.ChunkSystem; +import net.minecraft.server.level.ChunkHolder; -+import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ServerLevel; ++import net.minecraft.util.AbortableIterationConsumer; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; @@ -2872,15 +2872,15 @@ index 0000000000000000000000000000000000000000..c37adf64ad6133a8d79bfad4a852a6a7 + } + + @Override -+ public void get(final EntityTypeTest filter, final Consumer action) { ++ public void get(final EntityTypeTest filter, final AbortableIterationConsumer action) { + for (final Entity entity : this.entityById.values()) { + final Visibility visibility = EntityLookup.getEntityStatus(entity); + if (!visibility.isAccessible()) { + continue; + } + final U casted = filter.tryCast(entity); -+ if (casted != null) { -+ action.accept(casted); ++ if (casted != null && action.accept(casted).shouldAbort()) { ++ break; + } + } + } @@ -2895,13 +2895,13 @@ index 0000000000000000000000000000000000000000..c37adf64ad6133a8d79bfad4a852a6a7 + } + + @Override -+ public void get(final EntityTypeTest filter, final AABB box, final Consumer action) { ++ public void get(final EntityTypeTest filter, final AABB box, final AbortableIterationConsumer action) { + List entities = new ArrayList<>(); + this.getEntitiesWithoutDragonParts(null, box, entities, null); + for (int i = 0, len = entities.size(); i < len; ++i) { + final U casted = filter.tryCast(entities.get(i)); -+ if (casted != null) { -+ action.accept(casted); ++ if (casted != null && action.accept(casted).shouldAbort()) { ++ break; + } + } + } @@ -13532,7 +13532,7 @@ index a7feddc31da0870faa3d32a7108282e9e9143180..2ba3bb4e5670ece798a8882801a856d8 // Paper end } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index ecb5a18874509341dd691b290ea7d1f8c17e0bd7..159269d15c95261bddd410e337132c67d13c273c 100644 +index 779783037d024792f8052fea0ea8dbe6f06bc181..38143bac35ba18590a26552820b27b9b12279ea6 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -125,10 +125,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -14530,7 +14530,7 @@ index ecb5a18874509341dd691b290ea7d1f8c17e0bd7..159269d15c95261bddd410e337132c67 } public void addEntity(Entity entity) { -@@ -1597,7 +1087,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1595,7 +1085,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @Override protected boolean isChunkToRemove(long pos) { @@ -14539,7 +14539,7 @@ index ecb5a18874509341dd691b290ea7d1f8c17e0bd7..159269d15c95261bddd410e337132c67 } @Nullable -@@ -1678,7 +1168,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1676,7 +1166,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (player != this.entity) { Vec3 vec3d = player.position().subtract(this.entity.position()); @@ -16640,7 +16640,7 @@ index 53cf5c1292bc919e1c396328211421cb8d4ff8bb..de9aac5a8ef1c95385d0dc532c7764fe public abstract void applyCarvers(WorldGenRegion chunkRegion, long seed, RandomState noiseConfig, BiomeManager biomeAccess, StructureManager structureAccessor, ChunkAccess chunk, GenerationStep.Carving carverStep); diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -index bf66cdb94daa6657e9415adfa16d16983b258ee3..d3fe4f948d7ad8268f143c98211ef89b7fd96da1 100644 +index e2278ed457a7342d0d1b1a5fc1b5bdef6358816b..71df7c590e31932f2b8fc26a2afaaa54f52674ac 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java @@ -30,6 +30,30 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp diff --git a/patches/server/0211-Implement-EntityKnockbackByEntityEvent.patch b/patches/server/0211-Implement-EntityKnockbackByEntityEvent.patch index 0a1d292830..7b9521d77e 100644 --- a/patches/server/0211-Implement-EntityKnockbackByEntityEvent.patch +++ b/patches/server/0211-Implement-EntityKnockbackByEntityEvent.patch @@ -69,7 +69,7 @@ index 458a90529959d3ceae424236461cdeb4c588eedb..6f728231a7b326e605d6ddb8e4cd6f0f } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java -index 61328cde67c994c4ec0629b5869a878eda7c6cab..f40eec0f8b8ab664fc29da5a5043f6464594e55b 100644 +index 61328cde67c994c4ec0629b5869a878eda7c6cab..9b64a465be77bcc07e420c84f19fe75816e0ead1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java @@ -78,7 +78,7 @@ public class RamTarget extends Behavior { @@ -77,12 +77,12 @@ index 61328cde67c994c4ec0629b5869a878eda7c6cab..f40eec0f8b8ab664fc29da5a5043f646 float g = Mth.clamp(entity.getSpeed() * 1.65F, 0.2F, 3.0F) + f; float h = livingEntity.isDamageSourceBlocked(DamageSource.mobAttack(entity)) ? 0.5F : 1.0F; - livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z()); -+ livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), goat); // Paper ++ livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity); // Paper this.finishRam(world, entity); world.playSound((Player)null, entity, this.getImpactSound.apply(entity), SoundSource.NEUTRAL, 1.0F, 1.0F); } else if (this.hasRammedHornBreakingBlock(world, entity)) { diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 8aa5f8bacb868a3b04af6e696f9eed89463ecaf3..2c93f9add161ce1aecb7e647c2c2e004cc3caf7e 100644 +index b6027f4f5f747b81062d83ef7a3f62d420832729..26709e64ffbe1a41516908e4b3fc9d21d4c0dff0 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1278,7 +1278,7 @@ public abstract class Player extends LivingEntity { diff --git a/patches/server/0212-Expand-Explosions-API.patch b/patches/server/0212-Expand-Explosions-API.patch index bdbc5a53b2..73ea8df568 100644 --- a/patches/server/0212-Expand-Explosions-API.patch +++ b/patches/server/0212-Expand-Explosions-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expand Explosions API Add Entity as a Source capability, and add more API choices, and on Location. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 164b54410ecfe68a6d6239baf6e0e3699fbafbde..776bbbbeae53cc6a89546f571b07b0c13376f29a 100644 +index 164b54410ecfe68a6d6239baf6e0e3699fbafbde..8cbc73148f9d5fc4a76637812b448c3e09ba430c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -702,6 +702,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -16,7 +16,7 @@ index 164b54410ecfe68a6d6239baf6e0e3699fbafbde..776bbbbeae53cc6a89546f571b07b0c1 + // Paper start + @Override + public boolean createExplosion(Entity source, Location loc, float power, boolean setFire, boolean breakBlocks) { -+ return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? Explosion.BlockInteraction.BREAK : Explosion.BlockInteraction.NONE).wasCanceled; ++ return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled; + } + // Paper end diff --git a/patches/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch b/patches/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch index 4ae690f9d8..ffa193f6e9 100644 --- a/patches/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch +++ b/patches/server/0258-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 01ceb8de8411193fa407bf19bbd25a4bf44765d3..4304ee35a9bd912c2ae4058febf22f0eea25adbd 100644 +index 01ceb8de8411193fa407bf19bbd25a4bf44765d3..faa0d91713fb19820ca744f8c9449f79f44a55cb 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -83,6 +83,12 @@ import org.bukkit.persistence.PersistentDataContainer; @@ -351,7 +351,7 @@ index 01ceb8de8411193fa407bf19bbd25a4bf44765d3..4304ee35a9bd912c2ae4058febf22f0e + boolean isTag = raw.length() > 0 && raw.codePointAt(0) == '#'; + com.mojang.datafixers.util.Either result; + try { -+ result = net.minecraft.commands.arguments.blocks.BlockStateParser.parseForTesting(net.minecraft.core.Registry.BLOCK, raw, false); ++ result = net.minecraft.commands.arguments.blocks.BlockStateParser.parseForTesting(net.minecraft.core.registries.BuiltInRegistries.BLOCK.asLookup(), raw, false); + } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { + return null; + } @@ -360,7 +360,7 @@ index 01ceb8de8411193fa407bf19bbd25a4bf44765d3..4304ee35a9bd912c2ae4058febf22f0e + if (isTag && result.right().isPresent() && result.right().get().tag() instanceof net.minecraft.core.HolderSet.Named namedSet) { + key = namedSet.key().location(); + } else if (result.left().isPresent()) { -+ key = net.minecraft.core.Registry.BLOCK.getKey(result.left().get().blockState().getBlock()); ++ key = net.minecraft.core.registries.BuiltInRegistries.BLOCK.getKey(result.left().get().blockState().getBlock()); + } + + if (key == null) { diff --git a/patches/server/0345-Anti-Xray.patch b/patches/server/0345-Anti-Xray.patch index 62ed136a2c..ca4b4e96a7 100644 --- a/patches/server/0345-Anti-Xray.patch +++ b/patches/server/0345-Anti-Xray.patch @@ -1045,7 +1045,7 @@ index 7825d6f0fdcfda6212cff8033ec55fb7db236154..000853110c7a89f2d0403a7a2737025a public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 512e8ace73635e5494ec09bee29148617d45b460..f264c550917ca1337c27863db23003e4fda4d0b9 100644 +index 2a988b6cd8ef3b3d9a0e857fcc0bb4459d815a47..750b1f0793efc2e45846d6f6f03852f2d11d949a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -630,7 +630,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1057,7 +1057,7 @@ index 512e8ace73635e5494ec09bee29148617d45b460..f264c550917ca1337c27863db23003e4 if (player.level == this.level) { if (newWithinViewDistance && !oldWithinViewDistance) { ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong()); -@@ -1134,12 +1134,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1132,12 +1132,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -1538,7 +1538,7 @@ index 9b5d3dbf302a44d6ed774c8397117e7a6231b2f9..b8e2b34973ea980e527a2064d10b21a4 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index cef2d2494268c968dc8d26f9d5d0ee68a4ad465c..3f7b277cd931a60d348802114ee2a1af02c479e0 100644 +index 0c1c0fdfc6b1ab305b560d272efde4565922eac5..caacf6dbe6c4fd461624ea421d08a18222fc2a6e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -409,11 +409,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/server/0347-Tracking-Range-Improvements.patch b/patches/server/0347-Tracking-Range-Improvements.patch index 593a29348e..b732776aa1 100644 --- a/patches/server/0347-Tracking-Range-Improvements.patch +++ b/patches/server/0347-Tracking-Range-Improvements.patch @@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index f264c550917ca1337c27863db23003e4fda4d0b9..5ecd6a2027f6c0f11d10ca63cd63f0663f05347c 100644 +index 750b1f0793efc2e45846d6f6f03852f2d11d949a..e88ee89fba41911da4895e9fa024335f06887690 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1322,6 +1322,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1320,6 +1320,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); int j = entity.getType().clientTrackingRange() * 16; diff --git a/patches/server/0410-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0410-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index b74866731e..07f5514032 100644 --- a/patches/server/0410-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0410-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -18,10 +18,10 @@ index 05ac41e136da43284fb24a6b698ebd36318278fb..5ca3ad7b3d7606accd0a58b3c708fadb @VisibleForTesting static long encode(double value) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 6b01d5b5535887eef0ac7b8a5e0a669a2700e83f..f18df9d9e569bda32865a05e85a843f0422e17cf 100644 +index eb08e086ee57a41de550dbae130a7d68562e1728..1da687083a52b97b6245185eb2e73380da5ae8fd 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1339,9 +1339,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1337,9 +1337,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public void updatePlayer(ServerPlayer player) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (player != this.entity) { diff --git a/patches/server/0414-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/0414-Use-distance-map-to-optimise-entity-tracker.patch index df0de871e8..732a0f1143 100644 --- a/patches/server/0414-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/0414-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index d17a5b8d6f1b61ac1894e642d70704881c343f25..993d04766c81990e72166f1348a01d8ef7e05d0f 100644 +index eb3b54b5e01528e3801e9f15733bd5f3db56f17f..d1091b6b87534a3f9c2b8df74f40facc82679d80 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -68,6 +68,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; @@ -195,7 +195,7 @@ index d17a5b8d6f1b61ac1894e642d70704881c343f25..993d04766c81990e72166f1348a01d8e List list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); -@@ -1250,46 +1348,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1248,46 +1346,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider })); // Paper end DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); @@ -243,7 +243,7 @@ index d17a5b8d6f1b61ac1894e642d70704881c343f25..993d04766c81990e72166f1348a01d8e } -@@ -1344,6 +1403,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1342,6 +1401,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastSectionPos = SectionPos.of((EntityAccess) entity); } diff --git a/patches/server/0476-Cache-block-data-strings.patch b/patches/server/0476-Cache-block-data-strings.patch index cf4a528f8e..a3a8b3d59a 100644 --- a/patches/server/0476-Cache-block-data-strings.patch +++ b/patches/server/0476-Cache-block-data-strings.patch @@ -17,7 +17,7 @@ index 8e101269ca2edf5f3cc9c1ccedd03afaf1392d19..8ce413404930cca3a470bb58d73b9bd0 if (this.isSameThread()) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 6182ce8c32a334d3488c03f42bf3befcc0b80503..76efbcb951b133246bd9cbd8808f900f958d9298 100644 +index 6182ce8c32a334d3488c03f42bf3befcc0b80503..45c90505c778bfdebf0884190a422d12a0673d71 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -509,9 +509,39 @@ public class CraftBlockData implements BlockData { @@ -46,7 +46,7 @@ index 6182ce8c32a334d3488c03f42bf3befcc0b80503..76efbcb951b133246bd9cbd8808f900f + if (material != null) { + Block block = CraftMagicNumbers.getBlock(material); + if (block != null) { -+ net.minecraft.resources.ResourceLocation key = Registry.BLOCK.getKey(block); ++ net.minecraft.resources.ResourceLocation key = BuiltInRegistries.BLOCK.getKey(block); + data = data == null ? key.toString() : key + data; + } + } diff --git a/patches/server/0543-Added-PlayerLoomPatternSelectEvent.patch b/patches/server/0543-Added-PlayerLoomPatternSelectEvent.patch index af8aa036a1..f3c5c42bb9 100644 --- a/patches/server/0543-Added-PlayerLoomPatternSelectEvent.patch +++ b/patches/server/0543-Added-PlayerLoomPatternSelectEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Added PlayerLoomPatternSelectEvent diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -index b7f3dc81ecac0d814203028a9213f304bcc19574..a43b439864df5e5b3a66c8bcb2750e671c1dbf14 100644 +index b7f3dc81ecac0d814203028a9213f304bcc19574..8dc626e7e37161901f660116814ea4f6f2920510 100644 --- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java @@ -173,8 +173,35 @@ public class LoomMenu extends AbstractContainerMenu { @@ -31,9 +31,9 @@ index b7f3dc81ecac0d814203028a9213f304bcc19574..a43b439864df5e5b3a66c8bcb2750e67 + } + } + if (selectedPattern == null) { -+ for (BannerPattern pattern : Registry.BANNER_PATTERN) { ++ for (BannerPattern pattern : BuiltInRegistries.BANNER_PATTERN) { + if (event.getPatternType().getIdentifier().equals(pattern.getHashname())) { -+ selectedPattern = Registry.BANNER_PATTERN.getHolder(Registry.BANNER_PATTERN.getId(pattern)).orElseThrow(); ++ selectedPattern = BuiltInRegistries.BANNER_PATTERN.getHolder(BuiltInRegistries.BANNER_PATTERN.getId(pattern)).orElseThrow(); + break; + } + } diff --git a/patches/server/0551-Add-StructuresLocateEvent.patch b/patches/server/0551-Add-StructuresLocateEvent.patch index 71d684543e..1a0a9a1c8d 100644 --- a/patches/server/0551-Add-StructuresLocateEvent.patch +++ b/patches/server/0551-Add-StructuresLocateEvent.patch @@ -6,34 +6,37 @@ Subject: [PATCH] Add StructuresLocateEvent Co-authored-by: Jake Potrebic diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java -index 6f39e343147803e15e7681c993b8797a629702e7..87154ae69788249960bca376aafd90bf64d5bfe7 100644 +index 6f39e343147803e15e7681c993b8797a629702e7..3a643d57b646c83974b5157b9cbb2a9f42e9bd59 100644 --- a/src/main/java/io/papermc/paper/registry/RegistryKey.java +++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java -@@ -1,8 +1,13 @@ +@@ -1,8 +1,14 @@ package io.papermc.paper.registry; +import io.papermc.paper.world.structure.ConfiguredStructure; import net.minecraft.core.Registry; ++import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.levelgen.structure.Structure; import org.bukkit.Keyed; public record RegistryKey(Class apiClass, ResourceKey> resourceKey) { + -+ public static final RegistryKey CONFIGURED_STRUCTURE_REGISTRY = new RegistryKey<>(ConfiguredStructure.class, Registry.STRUCTURE_REGISTRY); ++ public static final RegistryKey CONFIGURED_STRUCTURE_REGISTRY = new RegistryKey<>(ConfiguredStructure.class, Registries.STRUCTURE); + } diff --git a/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java b/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java new file mode 100644 -index 0000000000000000000000000000000000000000..423bf87ebda7ea266dc7b48cbfadbc8551180721 +index 0000000000000000000000000000000000000000..16996c743b169e625ec810523c1d59a305e1d159 --- /dev/null +++ b/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java -@@ -0,0 +1,42 @@ +@@ -0,0 +1,44 @@ +package io.papermc.paper.world.structure; + +import io.papermc.paper.registry.PaperRegistry; +import io.papermc.paper.registry.RegistryKey; +import net.minecraft.core.Registry; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.levelgen.structure.Structure; +import org.bukkit.NamespacedKey; @@ -57,7 +60,7 @@ index 0000000000000000000000000000000000000000..423bf87ebda7ea266dc7b48cbfadbc85 + + static final class ConfiguredStructureRegistry extends PaperRegistry { + -+ private static final Supplier> STRUCTURE_FEATURE_REGISTRY = registryFor(Registry.STRUCTURE_REGISTRY); ++ private static final Supplier> STRUCTURE_FEATURE_REGISTRY = registryFor(Registries.STRUCTURE); + + public ConfiguredStructureRegistry() { + super(RegistryKey.CONFIGURED_STRUCTURE_REGISTRY); @@ -65,7 +68,7 @@ index 0000000000000000000000000000000000000000..423bf87ebda7ea266dc7b48cbfadbc85 + + @Override + public @Nullable ConfiguredStructure convertToApi(NamespacedKey key, Structure nms) { -+ final ResourceLocation structureTypeLoc = Objects.requireNonNull(Registry.STRUCTURE_TYPES.getKey(nms.type()), "unexpected structure type " + nms.type()); ++ final ResourceLocation structureTypeLoc = Objects.requireNonNull(BuiltInRegistries.STRUCTURE_TYPE.getKey(nms.type()), "unexpected structure type " + nms.type()); + final @Nullable StructureType structureType = StructureType.getStructureTypes().get(structureTypeLoc.getPath()); + return structureType == null ? null : new ConfiguredStructure(key, structureType); + } diff --git a/patches/server/0558-Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/0558-Added-firing-of-PlayerChangeBeaconEffectEvent.patch index 97e3a198b8..09742326a4 100644 --- a/patches/server/0558-Added-firing-of-PlayerChangeBeaconEffectEvent.patch +++ b/patches/server/0558-Added-firing-of-PlayerChangeBeaconEffectEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java -index 5e6582110c97287f0a2ed6e8d1a8f5e1ee2c81e5..eaf8ad2f704467bcba596d1c848dfdb75849e934 100644 +index 5e6582110c97287f0a2ed6e8d1a8f5e1ee2c81e5..4e40203125b2931d45666fccb022e84622ea61c2 100644 --- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java @@ -158,13 +158,27 @@ public class BeaconMenu extends AbstractContainerMenu { @@ -14,7 +14,7 @@ index 5e6582110c97287f0a2ed6e8d1a8f5e1ee2c81e5..eaf8ad2f704467bcba596d1c848dfdb7 } + // Paper start + private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional effect) { -+ return effect.flatMap(net.minecraft.core.Registry.MOB_EFFECT::getResourceKey).map(key -> { ++ return effect.flatMap(net.minecraft.core.registries.BuiltInRegistries.MOB_EFFECT::getResourceKey).map(key -> { + return org.bukkit.potion.PotionEffectType.getByKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location())); + }).orElse(null); + } diff --git a/patches/server/0721-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0721-Oprimise-map-impl-for-tracked-players.patch index aa79e9cced..b980d8a838 100644 --- a/patches/server/0721-Oprimise-map-impl-for-tracked-players.patch +++ b/patches/server/0721-Oprimise-map-impl-for-tracked-players.patch @@ -7,10 +7,10 @@ Reference2BooleanOpenHashMap is going to have better lookups than HashMap. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 109baae0c68b28720508af4a9e0b32b72b3dcb23..fab05c504ede66b91f07666341df70338ab4b6db 100644 +index 093bf9d33edd0e43b52a1fd14ad31881439ee8b9..1d4531b81a137bbf55d69d9116e0f23859bb0e51 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1397,7 +1397,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1395,7 +1395,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; diff --git a/patches/server/0802-Add-GameEvent-tags.patch b/patches/server/0802-Add-GameEvent-tags.patch index 7e1597fb41..a35e4810c3 100644 --- a/patches/server/0802-Add-GameEvent-tags.patch +++ b/patches/server/0802-Add-GameEvent-tags.patch @@ -6,13 +6,14 @@ Subject: [PATCH] Add GameEvent tags diff --git a/src/main/java/io/papermc/paper/CraftGameEventTag.java b/src/main/java/io/papermc/paper/CraftGameEventTag.java new file mode 100644 -index 0000000000000000000000000000000000000000..cb78a3d4e21376ea24347187478525d5f0c24079 +index 0000000000000000000000000000000000000000..e7d9fd2702a1ce96596580fff8f5ee4fd3d22b5b --- /dev/null +++ b/src/main/java/io/papermc/paper/CraftGameEventTag.java -@@ -0,0 +1,34 @@ +@@ -0,0 +1,35 @@ +package io.papermc.paper; + -+import net.minecraft.core.Registry; ++import net.minecraft.core.registries.BuiltInRegistries; ++import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.tags.TagKey; +import org.bukkit.GameEvent; @@ -36,12 +37,12 @@ index 0000000000000000000000000000000000000000..cb78a3d4e21376ea24347187478525d5 + private static final Map> KEY_CACHE = Collections.synchronizedMap(new IdentityHashMap<>()); + @Override + public boolean isTagged(@NotNull GameEvent gameEvent) { -+ return registry.getHolderOrThrow(KEY_CACHE.computeIfAbsent(gameEvent, event -> ResourceKey.create(Registry.GAME_EVENT_REGISTRY, CraftNamespacedKey.toMinecraft(event.getKey())))).is(tag); ++ return registry.getHolderOrThrow(KEY_CACHE.computeIfAbsent(gameEvent, event -> ResourceKey.create(Registries.GAME_EVENT, CraftNamespacedKey.toMinecraft(event.getKey())))).is(tag); + } + + @Override + public @NotNull Set getValues() { -+ return getHandle().stream().map((nms) -> Objects.requireNonNull(GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(Registry.GAME_EVENT.getKey(nms.value()))), nms + " is not a recognized game event")).collect(Collectors.toUnmodifiableSet()); ++ return getHandle().stream().map((nms) -> Objects.requireNonNull(GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(nms.value()))), nms + " is not a recognized game event")).collect(Collectors.toUnmodifiableSet()); + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/patches/server/0889-Workaround-for-client-lag-spikes-MC-162253.patch b/patches/server/0889-Workaround-for-client-lag-spikes-MC-162253.patch index 468cfa65f9..fb898ad798 100644 --- a/patches/server/0889-Workaround-for-client-lag-spikes-MC-162253.patch +++ b/patches/server/0889-Workaround-for-client-lag-spikes-MC-162253.patch @@ -16,10 +16,10 @@ Co-authored-by: =?UTF-8?q?Dani=C3=ABl=20Goossens?= Co-authored-by: Nassim Jahnke diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index fb47e820beb5b8224a44d41a7b83e10e6eb783c1..01420d687b0ffac4dd1f784c95525f811069b4d1 100644 +index 11cf01752d763621a1102120421261e6fce847f8..f5aa2560de5f386726677caac6414237d9c6512d 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1365,6 +1365,46 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1363,6 +1363,46 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } @@ -66,7 +66,7 @@ index fb47e820beb5b8224a44d41a7b83e10e6eb783c1..01420d687b0ffac4dd1f784c95525f81 // Paper start - Anti-Xray - Bypass private void playerLoadedChunk(ServerPlayer player, MutableObject> cachedDataPackets, LevelChunk chunk) { if (cachedDataPackets.getValue() == null) { -@@ -1373,6 +1413,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1371,6 +1411,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider Boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk); player.trackChunk(chunk.getPos(), (Packet) cachedDataPackets.getValue().computeIfAbsent(shouldModify, (s) -> {