diff --git a/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch index 4e164afbad..d1615a5f48 100644 --- a/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ b/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -12,15 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 EntityType entitytypes; if (tileentity instanceof Spawner) { -+ if (!world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) { // Paper - add condition ++ if (world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper ++ Spawner spawner = (Spawner) tileentity; entitytypes = this.getType(itemstack.getTag()); -@@ -0,0 +0,0 @@ public class SpawnEggItem extends Item { - world.gameEvent((Entity) context.getPlayer(), GameEvent.BLOCK_CHANGE, blockposition); - itemstack.shrink(1); - return InteractionResult.CONSUME; -+ } // Paper - end if - } else { - BlockPos blockposition1; - diff --git a/patches/server/Collision-API.patch b/patches/server/Collision-API.patch index ca56c45ede..7a2da86c36 100644 --- a/patches/server/Collision-API.patch +++ b/patches/server/Collision-API.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java @@ -0,0 +0,0 @@ public abstract class CraftRegionAccessor implements RegionAccessor { - return this.getHandle().clip(new net.minecraft.world.level.ClipContext(start, end, net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, null)).getType() == net.minecraft.world.phys.HitResult.Type.MISS; + return this.getHandle().clip(new net.minecraft.world.level.ClipContext(start, end, net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, net.minecraft.world.phys.shapes.CollisionContext.empty())).getType() == net.minecraft.world.phys.HitResult.Type.MISS; } + + @Override diff --git a/patches/server/Complete-resource-pack-API.patch b/patches/server/Complete-resource-pack-API.patch index c5ef910176..49b0f2a0aa 100644 --- a/patches/server/Complete-resource-pack-API.patch +++ b/patches/server/Complete-resource-pack-API.patch @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + net.minecraft.network.chat.Component promptComponent = resourcePackPrompt != null ? + io.papermc.paper.adventure.PaperAdventure.asVanilla(resourcePackPrompt) : + null; -+ this.getHandle().connection.send(new ClientboundResourcePackPacket(url, hash, required, promptComponent)); ++ this.getHandle().connection.send(new ClientboundResourcePackPushPacket(UUID.randomUUID(), url, hash, required, promptComponent)); + } + + @Override diff --git a/patches/server/Configurable-Player-Collision.patch b/patches/server/Configurable-Player-Collision.patch index ae3ad633b8..ff1f82067b 100644 --- a/patches/server/Configurable-Player-Collision.patch +++ b/patches/server/Configurable-Player-Collision.patch @@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Remove collideRule team if it exists + if (this.collideRuleTeamName != null) { -+ final Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard(); ++ final net.minecraft.world.scores.Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard(); + final PlayerTeam team = scoreboard.getPlayersTeam(this.collideRuleTeamName); + if (team != null) scoreboard.removePlayerTeam(team); + } diff --git a/patches/server/Execute-chunk-tasks-mid-tick.patch b/patches/server/Execute-chunk-tasks-mid-tick.patch index 98f056bd59..e4f1063a50 100644 --- a/patches/server/Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/Execute-chunk-tasks-mid-tick.patch @@ -115,13 +115,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ServerChunkCache.ChunkAndHolder chunkproviderserver_a = (ServerChunkCache.ChunkAndHolder) iterator1.next(); LevelChunk chunk1 = chunkproviderserver_a.chunk; @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { + if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { - this.level.timings.doTickTiles.startTiming(); // Spigot this.level.tickChunk(chunk1, l); + if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper - this.level.timings.doTickTiles.stopTiming(); // Spigot } } + } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch index 26367339c4..a00ffacf80 100644 --- a/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag = this.tickRateManager().runsNormally(); int tilesThisCycle = 0; -+ var toRemove = new it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet(net.minecraft.Util.identityStrategy()); // Paper - use removeAll ++ var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - use removeAll + toRemove.add(null); for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; diff --git a/patches/server/Fix-tripwire-state-inconsistency.patch b/patches/server/Fix-tripwire-state-inconsistency.patch index b2ae0657aa..3611c62fc1 100644 --- a/patches/server/Fix-tripwire-state-inconsistency.patch +++ b/patches/server/Fix-tripwire-state-inconsistency.patch @@ -76,3 +76,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 aiblockdata[k] = iblockdata2; if (k == i) { world.scheduleTick(pos, block, 10); +@@ -0,0 +0,0 @@ public class TripWireHookBlock extends Block { + // CraftBukkit end + + TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3); +- if (!flag) { ++ if (!beingRemoved) { // Paper + if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - validate + world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3); + if (flag1) { diff --git a/patches/server/Line-Of-Sight-Changes.patch b/patches/server/Line-Of-Sight-Changes.patch index 98b1e93664..a8a70b3e11 100644 --- a/patches/server/Line-Of-Sight-Changes.patch +++ b/patches/server/Line-Of-Sight-Changes.patch @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return false; // Return early if the distance is greater than 128 blocks + } + -+ return this.getHandle().clip(new net.minecraft.world.level.ClipContext(start, end, net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, null)).getType() == net.minecraft.world.phys.HitResult.Type.MISS; ++ return this.getHandle().clip(new net.minecraft.world.level.ClipContext(start, end, net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, net.minecraft.world.phys.shapes.CollisionContext.empty())).getType() == net.minecraft.world.phys.HitResult.Type.MISS; + } // Paper end } diff --git a/patches/server/Optimise-chunk-tick-iteration.patch b/patches/server/Optimise-chunk-tick-iteration.patch index 4021e2a036..af57a58349 100644 --- a/patches/server/Optimise-chunk-tick-iteration.patch +++ b/patches/server/Optimise-chunk-tick-iteration.patch @@ -350,10 +350,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { + if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - optimise chunk tick iteration - this.level.timings.doTickTiles.startTiming(); // Spigot this.level.tickChunk(chunk1, l); if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper -@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { } } } diff --git a/patches/server/Rewrite-chunk-system.patch b/patches/server/Rewrite-chunk-system.patch index 7dadbf5c93..0e70321cd0 100644 --- a/patches/server/Rewrite-chunk-system.patch +++ b/patches/server/Rewrite-chunk-system.patch @@ -20102,6 +20102,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { + CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report); + + crashreportsystemdetails.setDetail("Loaded entity count", () -> { +- return String.valueOf(this.entityManager.count()); ++ return String.valueOf(this.entityLookup.getAllCopy().length); // Paper + }); + return crashreportsystemdetails; + } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/patches/server/Rewrite-dataconverter-system.patch b/patches/server/Rewrite-dataconverter-system.patch index ca12b5ec94..ada692326a 100644 --- a/patches/server/Rewrite-dataconverter-system.patch +++ b/patches/server/Rewrite-dataconverter-system.patch @@ -24899,6 +24899,14 @@ diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource. index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java +@@ -0,0 +0,0 @@ import com.mojang.datafixers.DataFixer; + import com.mojang.logging.LogUtils; + import com.mojang.serialization.DataResult; + import com.mojang.serialization.Dynamic; ++import com.mojang.serialization.DynamicOps; + import com.mojang.serialization.Lifecycle; + import java.io.BufferedOutputStream; + import java.io.BufferedReader; @@ -0,0 +0,0 @@ public class LevelStorageSource { static Dynamic readLevelDataTagFixed(Path path, DataFixer dataFixer) throws IOException { CompoundTag nbttagcompound = LevelStorageSource.readLevelDataTagRaw(path); @@ -24908,10 +24916,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Dynamic dynamic = DataFixTypes.LEVEL.updateToCurrentVersion(dataFixer, new Dynamic(NbtOps.INSTANCE, nbttagcompound1), i); Dynamic dynamic1 = dynamic.get("Player").orElseEmptyMap(); - Dynamic dynamic2 = DataFixTypes.PLAYER.updateToCurrentVersion(dataFixer, dynamic1, i); -+ Dynamic dynamic2 = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, dynamic1, version, SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper ++ Dynamic dynamic2 = LevelStorageSource.dank(dynamic1, version); // Paper dynamic = dynamic.set("Player", dynamic2); Dynamic dynamic3 = dynamic.get("WorldGenSettings").orElseEmptyMap(); +@@ -0,0 +0,0 @@ public class LevelStorageSource { + return dynamic; + } + ++ // Paper start ++ private static Dynamic dank(final Dynamic input, final int version) { ++ return new Dynamic<>(input.getOps(), (T) ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, (CompoundTag)input.getValue(), version, net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion())); ++ } ++ // Paper end ++ + private LevelSummary readLevelSummary(LevelStorageSource.LevelDirectory save, boolean locked) { + Path path = save.dataFile(); + diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch index 7a132ca1c3..69a5b69e47 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -1095,6 +1095,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastSpawnState = spawnercreature_d; gameprofilerfiller.popPush("spawnAndTick"); @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { + } + + if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { +- this.level.timings.doTickTiles.startTiming(); // Spigot + this.level.tickChunk(chunk1, l); +- this.level.timings.doTickTiles.stopTiming(); // Spigot + } + } + } gameprofilerfiller.popPush("customSpawners"); if (flag) {