diff --git a/patches/server/Custom-Potion-Mixes.patch b/patches/server/Custom-Potion-Mixes.patch index 16d6191a0b..f42fac11fc 100644 --- a/patches/server/Custom-Potion-Mixes.patch +++ b/patches/server/Custom-Potion-Mixes.patch @@ -40,9 +40,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.worldData.setDataConfiguration(worlddataconfiguration); this.resources.managers.updateRegistryTags(this.registryAccess()); + net.minecraft.world.item.alchemy.PotionBrewing.reload(); // Paper - Custom Potion Mixes - // Paper start - if (Thread.currentThread() != this.serverThread) { - return; + this.getPlayerList().saveAll(); + this.getPlayerList().reloadResources(); + this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); diff --git a/src/main/java/net/minecraft/world/inventory/BrewingStandMenu.java b/src/main/java/net/minecraft/world/inventory/BrewingStandMenu.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/inventory/BrewingStandMenu.java diff --git a/patches/server/Fix-dangerous-end-portal-logic.patch b/patches/server/Fix-dangerous-end-portal-logic.patch index d9e7b977ed..64ef2a85e6 100644 --- a/patches/server/Fix-dangerous-end-portal-logic.patch +++ b/patches/server/Fix-dangerous-end-portal-logic.patch @@ -15,9 +15,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S + + public boolean updatingSectionStatus = false; // Paper end - // Paper start - optimise entity tracking - final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this); + // Paper start - make end portalling safe + public BlockPos portalBlock; + public ServerLevel portalWorld; @@ -42,15 +42,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + event.callEvent(); + + if (this instanceof ServerPlayer) { -+ ((ServerPlayer)this).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); ++ ((ServerPlayer) this).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); + return; + } + this.teleportTo(worldserver, null); + } + // Paper end - make end portalling safe - public boolean isLegacyTrackingEntity = false; - + public Entity(EntityType type, Level world) { + this.id = Entity.ENTITY_COUNTER.incrementAndGet(); @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } diff --git a/patches/server/Fix-plugin-loggers-on-server-shutdown.patch b/patches/server/Fix-plugin-loggers-on-server-shutdown.patch index a60d872a7b..6fc1a38207 100644 --- a/patches/server/Fix-plugin-loggers-on-server-shutdown.patch +++ b/patches/server/Fix-plugin-loggers-on-server-shutdown.patch @@ -41,13 +41,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop flags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. - private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector - -+ // Paper start - Mob goal API; make sure goaltypes is never empty -+ public Goal() { -+ if (this.goalTypes.size() == 0) { -+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR); -+ } -+ } -+ // Paper end - Mob goal API -+ - public abstract boolean canUse(); - - public boolean canContinueToUse() { -@@ -0,0 +0,0 @@ public abstract class Goal { - // Paper start - remove streams from pathfindergoalselector - this.goalTypes.clear(); - this.goalTypes.addAllUnchecked(controls); -+ // make sure its never empty -+ if (this.goalTypes.size() == 0) { -+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR); -+ } - // Paper end - remove streams from pathfindergoalselector - } - @@ -0,0 +0,0 @@ public abstract class Goal { return Mth.positiveCeilDiv(serverTicks, 2); } + // Paper start - Mob goal api -+ private com.destroystokyo.paper.entity.ai.PaperVanillaGoal vanillaGoal = null; ++ private com.destroystokyo.paper.entity.ai.PaperVanillaGoal vanillaGoal; + public com.destroystokyo.paper.entity.ai.Goal asPaperVanillaGoal() { + if(this.vanillaGoal == null) { + this.vanillaGoal = new com.destroystokyo.paper.entity.ai.PaperVanillaGoal<>(this); diff --git a/patches/server/Improved-Watchdog-Support.patch b/patches/server/Improved-Watchdog-Support.patch index cc02b17d1f..e7ad9cfb17 100644 --- a/patches/server/Improved-Watchdog-Support.patch +++ b/patches/server/Improved-Watchdog-Support.patch @@ -84,8 +84,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot start public static final int TPS = 20; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop atomicreference = new AtomicReference(); Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); diff --git a/patches/server/Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/patches/server/Optimize-GoalSelector-Goal.Flag-Set-operations.patch index fc27b5d667..302310d6c4 100644 --- a/patches/server/Optimize-GoalSelector-Goal.Flag-Set-operations.patch +++ b/patches/server/Optimize-GoalSelector-Goal.Flag-Set-operations.patch @@ -17,6 +17,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private final EnumSet flags = EnumSet.noneOf(Goal.Flag.class); + private final EnumSet flags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. + private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector ++ ++ // Paper start - remove streams from pathfindergoalselector; make sure types are not empty ++ public Goal() { ++ if (this.goalTypes.size() == 0) { ++ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR); ++ } ++ } ++ // Paper end - remove streams from pathfindergoalselector public abstract boolean canUse(); @@ -29,6 +37,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - remove streams from pathfindergoalselector + this.goalTypes.clear(); + this.goalTypes.addAllUnchecked(controls); ++ if (this.goalTypes.size() == 0) { ++ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR); ++ } + // Paper end - remove streams from pathfindergoalselector } diff --git a/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch index d9f05652eb..015cc061af 100644 --- a/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - //DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); // Paper moved to after init + DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); if (dedicatedserverproperties.announcePlayerAchievements != null) { - ((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, this); + ((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, null); // Paper - Pass ServerLevel for gamerule callbacks diff --git a/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 13d4b204ac..1ec6f838b0 100644 --- a/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -81,8 +81,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { @@ -0,0 +0,0 @@ public class PistonBaseBlock extends DirectionalBlock { - BlockState iblockdata2 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT); - + } + // Paper end - Fix sticky pistons and BlockPistonRetractEvent world.setBlock(pos, iblockdata2, 20); - world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); + world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(pos, iblockdata2, (BlockState) this.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.from3DDataValue(data & 7)), enumdirection, false, true)); // Paper - Protect Bedrock and End Portal/Frames from being destroyed; diff on change diff --git a/patches/server/Temp-Pre-init-PlayerChunkLoaderData-in-order-to-prep.patch b/patches/server/Temp-Pre-init-PlayerChunkLoaderData-in-order-to-prep.patch deleted file mode 100644 index ef0a191f84..0000000000 --- a/patches/server/Temp-Pre-init-PlayerChunkLoaderData-in-order-to-prep.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sun, 18 Jun 2023 13:48:11 +0100 -Subject: [PATCH] Temp: Pre-init PlayerChunkLoaderData in order to prepopulate - the BFS lookup cache because potatos - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -0,0 +0,0 @@ public class Main { - tryPreloadClass(net.minecraft.world.level.lighting.LayerLightEventListener.DummyLightLayerEventListener.class.getName()); - tryPreloadClass(net.minecraft.world.level.lighting.LayerLightEventListener.class.getName()); - tryPreloadClass(net.minecraft.util.ExceptionCollector.class.getName()); -+ tryPreloadClass(io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData.class.getName()); // Paper - Prepopulate BFS lookup for potatos - // Paper end - } - } diff --git a/patches/server/Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/Throw-exception-on-world-create-while-being-ticked.patch index 1c72084df4..bee2573d09 100644 --- a/patches/server/Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/Throw-exception-on-world-create-while-being-ticked.patch @@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { diff --git a/patches/server/Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/Use-distance-map-to-optimise-entity-tracker.patch index 0c8e540e93..0a2581d9b1 100644 --- a/patches/server/Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/Use-distance-map-to-optimise-entity-tracker.patch @@ -248,9 +248,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S - - public boolean updatingSectionStatus = false; - // Paper end + this.teleportTo(worldserver, null); + } + // Paper end - make end portalling safe + // Paper start - optimise entity tracking + final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this); + diff --git a/patches/server/incremental-chunk-and-player-saving.patch b/patches/server/incremental-chunk-and-player-saving.patch index 83aa6ded49..105200bc08 100644 --- a/patches/server/incremental-chunk-and-player-saving.patch +++ b/patches/server/incremental-chunk-and-player-saving.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + int playerSaveInterval = io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.rate; + if (playerSaveInterval < 0) { + playerSaveInterval = autosavePeriod; -+ } + } + this.profiler.push("save"); + final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0; + try { @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } finally { + this.isSaving = false; - } ++ } + this.profiler.pop(); + // Paper end - Incremental chunk and player saving io.papermc.paper.util.CachedLists.reset(); // Paper diff --git a/patches/server/misc-debugging-dumps.patch b/patches/server/misc-debugging-dumps.patch index 08dfc42c83..b28bfa313c 100644 --- a/patches/server/misc-debugging-dumps.patch +++ b/patches/server/misc-debugging-dumps.patch @@ -46,9 +46,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop