diff --git a/sparklypaper-server/build.gradle.kts.patch b/sparklypaper-server/build.gradle.kts.patch index 376fd16..8fdb36c 100644 --- a/sparklypaper-server/build.gradle.kts.patch +++ b/sparklypaper-server/build.gradle.kts.patch @@ -1,6 +1,6 @@ --- a/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts -@@ -8,6 +_,8 @@ +@@ -5,6 +_,8 @@ plugins { `java-library` @@ -9,7 +9,7 @@ `maven-publish` idea id("io.papermc.paperweight.core") -@@ -23,6 +_,16 @@ +@@ -20,6 +_,16 @@ } paperweight { @@ -26,7 +26,7 @@ minecraftVersion = providers.gradleProperty("mcVersion") gitFilePatches = false -@@ -107,7 +_,19 @@ +@@ -104,7 +_,19 @@ } } @@ -47,7 +47,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { extendsFrom(configurations.compileClasspath.get()) } -@@ -130,7 +_,12 @@ +@@ -127,7 +_,12 @@ } dependencies { @@ -61,9 +61,9 @@ implementation("ca.spottedleaf:concurrentutil:0.0.5") implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 -@@ -195,9 +_,14 @@ +@@ -192,9 +_,14 @@ val build = System.getenv("BUILD_NUMBER") ?: null - val buildTime = if (build != null) Instant.now() else Instant.EPOCH + val buildTime = providers.environmentVariable("BUILD_STARTED_AT").map(Instant::parse).orElse(Instant.EPOCH).get() val gitHash = git.exec(providers, "rev-parse", "--short=7", "HEAD").get().trim() - val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash" + var implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash" // SparklyPaper @@ -77,7 +77,7 @@ attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", "Implementation-Title" to "Paper", -@@ -206,8 +_,8 @@ +@@ -203,8 +_,8 @@ "Specification-Title" to "Paper", "Specification-Version" to project.version, "Specification-Vendor" to "Paper Team", @@ -88,7 +88,7 @@ "Build-Number" to (build ?: ""), "Build-Time" to buildTime.toString(), "Git-Branch" to gitBranch, -@@ -266,7 +_,7 @@ +@@ -263,7 +_,7 @@ jvmArgumentProviders.add(provider) } diff --git a/sparklypaper-server/minecraft-patches/features/0001-Parallel-World-Ticking.patch b/sparklypaper-server/minecraft-patches/features/0001-Parallel-World-Ticking.patch index aa401c5..f62c69b 100644 --- a/sparklypaper-server/minecraft-patches/features/0001-Parallel-World-Ticking.patch +++ b/sparklypaper-server/minecraft-patches/features/0001-Parallel-World-Ticking.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Parallel World Ticking diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -index e03faa94df6c77ab4f3f5d9ffe107220387a0dde..44fb3f9baf5f5cb5226b975d76e2700c71a4f072 100644 +index 467065e3b40df17f38716499259b46663c174fd0..dcbcdbb641ecc5f724aff634e4685ff46262ebee 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -@@ -1124,7 +1124,7 @@ public final class ChunkHolderManager { +@@ -1129,7 +1129,7 @@ public final class ChunkHolderManager { if (changedFullStatus.isEmpty()) { return; } @@ -17,7 +17,7 @@ index e03faa94df6c77ab4f3f5d9ffe107220387a0dde..44fb3f9baf5f5cb5226b975d76e2700c // These will be handled on the next ServerChunkCache$MainThreadExecutor#pollTask, as it runs the distance manager update // which will invoke processTicketUpdates this.offThreadPendingFullLoadUpdate.addAll(changedFullStatus); -@@ -1145,7 +1145,7 @@ public final class ChunkHolderManager { +@@ -1150,7 +1150,7 @@ public final class ChunkHolderManager { // note: never call while inside the chunk system, this will absolutely break everything public void processUnloads() { @@ -26,7 +26,7 @@ index e03faa94df6c77ab4f3f5d9ffe107220387a0dde..44fb3f9baf5f5cb5226b975d76e2700c if (BLOCK_TICKET_UPDATES.get() == Boolean.TRUE) { throw new IllegalStateException("Cannot unload chunks recursively"); -@@ -1411,12 +1411,12 @@ public final class ChunkHolderManager { +@@ -1416,12 +1416,12 @@ public final class ChunkHolderManager { if (BLOCK_TICKET_UPDATES.get() == Boolean.TRUE) { throw new IllegalStateException("Cannot update ticket level while unloading chunks or updating entity manager"); } @@ -42,10 +42,10 @@ index e03faa94df6c77ab4f3f5d9ffe107220387a0dde..44fb3f9baf5f5cb5226b975d76e2700c if (this.ticketLevelPropagator.hasPendingUpdates()) { diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 703a75c7c6cd05a95afb630973250898dbc7223d..1bc84d3aa569222d20bc3c05b99de7590c35a195 100644 +index ef72c5d1b6196582cadb87944f3416881f56c8df..771643f41ff31fe0fc7822a16f7386ef61de2eeb 100644 --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -410,8 +410,8 @@ public interface DispenseItemBehavior { +@@ -412,8 +412,8 @@ public interface DispenseItemBehavior { // CraftBukkit start level.captureTreeGeneration = false; if (!level.capturedBlockStates.isEmpty()) { @@ -57,10 +57,10 @@ index 703a75c7c6cd05a95afb630973250898dbc7223d..1bc84d3aa569222d20bc3c05b99de759 List states = new java.util.ArrayList<>(level.capturedBlockStates.values()); level.capturedBlockStates.clear(); diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index f585af90e6311def989590a7787184af870c295e..0d49a8ee8863df568a679cf8a69b6c6a121e7caf 100644 +index fa8cbf83a5c7aa1f93251e3e809095a78842498b..47ed5577c6619238cbc492e949f5febc0fe98a9a 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -346,6 +346,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function threadFunction) { ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -1744,6 +1745,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - BlockPhysicsEvent serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent -@@ -1760,26 +1764,45 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> oldLevels = this.levels; Map, ServerLevel> newLevels = Maps.newLinkedHashMap(oldLevels); newLevels.remove(level.dimension()); @@ -148,7 +148,7 @@ index f585af90e6311def989590a7787184af870c295e..0d49a8ee8863df568a679cf8a69b6c6a } // CraftBukkit end diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index bd10a93b7cb856459bdd2639b245fe7da84f0063..1f9db5bed6796b9a07e30535877723b82468772b 100644 +index 8c672875e4598b3be69fa134ca4e7445d3ff6eee..45e7d31cb238fbb4f7f4351228b3828937e03ae5 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java @@ -269,6 +269,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -163,7 +163,7 @@ index bd10a93b7cb856459bdd2639b245fe7da84f0063..1f9db5bed6796b9a07e30535877723b8 this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 413f0673557b9e3f9177d15e9bef61bded209e34..db9c312c13c971e75fc4afeff5159564b69f5ca0 100644 +index 488fc6088d69148f60a913b42ffb964c48eb0324..13bb06468086f5e7871da739f7561dc067a26211 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java @@ -178,7 +178,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @@ -176,7 +176,7 @@ index 413f0673557b9e3f9177d15e9bef61bded209e34..db9c312c13c971e75fc4afeff5159564 } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index dbd0bfb29a27d1abd19db38cda280e6fdbb98cac..4bb75621a71f0993962665d191f424a62c8943bb 100644 +index 1f344b440aaa3543dbecb6068af87d5cb5625950..45fb110beffdaab0576431119901b586f9034bf5 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -188,7 +188,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -196,7 +196,7 @@ index dbd0bfb29a27d1abd19db38cda280e6fdbb98cac..4bb75621a71f0993962665d191f424a6 // CraftBukkit start public final LevelStorageSource.LevelStorageAccess levelStorageAccess; -@@ -682,7 +683,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -689,7 +690,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.sleepStatus = new SleepStatus(); this.gameEventDispatcher = new GameEventDispatcher(this); this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE)); @@ -205,7 +205,7 @@ index dbd0bfb29a27d1abd19db38cda280e6fdbb98cac..4bb75621a71f0993962665d191f424a6 // Paper start - rewrite chunk system this.moonrise$setEntityLookup(new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup((ServerLevel)(Object)this, ((ServerLevel)(Object)this).new EntityCallbacks())); this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this); -@@ -698,6 +699,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -705,6 +706,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler); // Paper end - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit @@ -213,7 +213,7 @@ index dbd0bfb29a27d1abd19db38cda280e6fdbb98cac..4bb75621a71f0993962665d191f424a6 } // Paper start -@@ -1265,7 +1267,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1272,7 +1274,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper start - rewrite chunk system if ((++this.tickedBlocksOrFluids & 7L) != 0L) { @@ -222,7 +222,7 @@ index dbd0bfb29a27d1abd19db38cda280e6fdbb98cac..4bb75621a71f0993962665d191f424a6 } // Paper end - rewrite chunk system -@@ -1278,7 +1280,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1285,7 +1287,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper start - rewrite chunk system if ((++this.tickedBlocksOrFluids & 7L) != 0L) { @@ -231,7 +231,7 @@ index dbd0bfb29a27d1abd19db38cda280e6fdbb98cac..4bb75621a71f0993962665d191f424a6 } // Paper end - rewrite chunk system -@@ -1549,6 +1551,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1556,6 +1558,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } private void addPlayer(ServerPlayer player) { @@ -239,7 +239,7 @@ index dbd0bfb29a27d1abd19db38cda280e6fdbb98cac..4bb75621a71f0993962665d191f424a6 Entity entity = this.getEntity(player.getUUID()); if (entity != null) { LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID()); -@@ -1561,7 +1564,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1568,7 +1571,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // CraftBukkit start private boolean addEntity(Entity entity, @Nullable org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { @@ -249,10 +249,10 @@ index dbd0bfb29a27d1abd19db38cda280e6fdbb98cac..4bb75621a71f0993962665d191f424a6 // Paper start - extra debug info if (entity.valid) { diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 00c77be8c02e5603bbb4207804d712a77994658b..669db63497387a80291194806873ad9f1f320099 100644 +index b4a996ac6c570e988b38237a32f90ec5042cbc17..ca161ad7fc7e33cb5b734961e8ca559a9241c932 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -472,6 +472,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -473,6 +473,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc return this.viewDistanceHolder; } // Paper end - rewrite chunk system @@ -260,7 +260,7 @@ index 00c77be8c02e5603bbb4207804d712a77994658b..669db63497387a80291194806873ad9f public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) { super(level, gameProfile); -@@ -716,6 +717,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -717,6 +718,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc @Override public void tick() { @@ -268,15 +268,16 @@ index 00c77be8c02e5603bbb4207804d712a77994658b..669db63497387a80291194806873ad9f // CraftBukkit start if (this.joining) { this.joining = false; -@@ -1518,6 +1520,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1529,6 +1531,8 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + teleportTransition.postTeleportTransition().onTransition(this); return this; } else { - // CraftBukkit start ++ // CraftBukkit start + ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot change dimension of a player off-main, from world " + serverLevel.getWorld().getName() + " to world " + level.getWorld().getName()); // SparklyPaper - parallel world ticking (additional concurrency issues logs) - /* this.isChangingDimension = true; LevelData levelData = level.getLevelData(); -@@ -1857,6 +1860,12 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(level), ClientboundRespawnPacket.KEEP_ALL_DATA)); +@@ -1836,6 +1840,12 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc return OptionalInt.empty(); } else { // CraftBukkit start @@ -289,7 +290,7 @@ index 00c77be8c02e5603bbb4207804d712a77994658b..669db63497387a80291194806873ad9f this.containerMenu = abstractContainerMenu; // Moved up if (!this.isImmobile()) this.connection -@@ -1921,6 +1930,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1900,6 +1910,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc } @Override public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { @@ -302,10 +303,10 @@ index 00c77be8c02e5603bbb4207804d712a77994658b..669db63497387a80291194806873ad9f // Paper end - Inventory close reason this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 9d7be1695f797c2c041d21a8326aeea46b0488d7..dfc77fa5baead50008381272b0f8e06e54346be5 100644 +index cc5d1e8007e2ea32605bd68d0a73683e8fb6886e..5a9e1eb49f17783ac71c8a555d6688b9dbbe4f9e 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -110,7 +110,7 @@ public abstract class PlayerList { +@@ -111,7 +111,7 @@ public abstract class PlayerList { private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private final MinecraftServer server; public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety @@ -314,7 +315,7 @@ index 9d7be1695f797c2c041d21a8326aeea46b0488d7..dfc77fa5baead50008381272b0f8e06e private final UserBanList bans; private final IpBanList ipBans; private final ServerOpList ops; -@@ -128,7 +128,7 @@ public abstract class PlayerList { +@@ -129,7 +129,7 @@ public abstract class PlayerList { // CraftBukkit start private org.bukkit.craftbukkit.CraftServer cserver; @@ -323,7 +324,7 @@ index 9d7be1695f797c2c041d21a8326aeea46b0488d7..dfc77fa5baead50008381272b0f8e06e public @Nullable String collideRuleTeamName; // Paper - Configurable player collision public PlayerList( -@@ -149,6 +149,7 @@ public abstract class PlayerList { +@@ -150,6 +150,7 @@ public abstract class PlayerList { abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie cookie) { @@ -331,27 +332,22 @@ index 9d7be1695f797c2c041d21a8326aeea46b0488d7..dfc77fa5baead50008381272b0f8e06e player.isRealPlayer = true; // Paper player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed NameAndId nameAndId = player.nameAndId(); -@@ -591,6 +592,12 @@ public abstract class PlayerList { - } +@@ -588,6 +589,7 @@ public abstract class PlayerList { - public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, @Nullable org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason, @Nullable org.bukkit.Location location) { -+ // SparklyPaper - parallel world ticking (additional concurrency issues logs) -+ if (location != null) // TODO: Is this really never null, or is IntelliJ IDEA tripping? Because I'm pretty sure that this can be null and there isn't any @NotNull annotations -+ ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot respawn player off-main, from world " + player.level().getWorld().getName() + " to world " + location.getWorld().getName()); -+ else -+ ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot respawn player off-main, respawning in world " + player.level().getWorld().getName()); -+ // SparklyPaper end - player.stopRiding(); // CraftBukkit - // TeleportTransition teleportTransition = player.findRespawnPositionAndUseSpawnBlock(!keepInventory, TeleportTransition.DO_NOTHING); - this.players.remove(player); -@@ -601,6 +608,7 @@ public abstract class PlayerList { - ServerPlayer serverPlayer = player; - Level fromWorld = player.level(); - player.wonGame = false; + // Paper start - respawn event + public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason respawnReason) { ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot respawn player off-main, respawning in world " + player.level().getWorld().getName()); + ServerPlayer.RespawnResult result = player.findRespawnPositionAndUseSpawnBlock0(!keepInventory, TeleportTransition.DO_NOTHING, respawnReason); + if (result == null) { // disconnected player during the respawn event + return player; +@@ -600,6 +602,7 @@ public abstract class PlayerList { + player.level().removePlayerImmediately(player, reason); + ServerLevel level = teleportTransition.newLevel(); + ServerPlayer serverPlayer = player; // Paper - TODO - recreate instance + serverPlayer.hasTickedAtLeastOnceInNewWorld = false; // SparklyPaper - parallel world ticking (see: PARALLEL_NOTES.md - Opening an inventory after a world switch) - // CraftBukkit end serverPlayer.connection = player.connection; serverPlayer.restoreFrom(player, keepInventory); + serverPlayer.setId(player.getId()); diff --git a/net/minecraft/server/waypoints/ServerWaypointManager.java b/net/minecraft/server/waypoints/ServerWaypointManager.java index f9e7532f86122a379692561a639a209a126e8bba..2709dfae53c1a210f36c45fa0df0d49536341a38 100644 --- a/net/minecraft/server/waypoints/ServerWaypointManager.java @@ -437,10 +433,10 @@ index f9e7532f86122a379692561a639a209a126e8bba..2709dfae53c1a210f36c45fa0df0d495 if (isLocatorBarEnabledFor(player)) { if (!connection.isBroken()) { diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 2d74876cd072e0fd0380bc53ed34da1cb1bc3a29..333e917750cf08b9b1b1c50089fd27311981b1e4 100644 +index 2e3e038874757049445a91bf590d5a1a427a3f6d..e719e41f292be412fa05f23912ec2caca9165473 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -840,7 +840,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -839,7 +839,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name // CraftBukkit start public void postTick() { // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle @@ -449,7 +445,7 @@ index 2d74876cd072e0fd0380bc53ed34da1cb1bc3a29..333e917750cf08b9b1b1c50089fd2731 this.handlePortal(); } } -@@ -4065,6 +4065,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4061,6 +4061,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @Nullable private Entity teleportCrossDimension(ServerLevel oldLevel, ServerLevel newLevel, TeleportTransition teleportTransition) { @@ -458,7 +454,7 @@ index 2d74876cd072e0fd0380bc53ed34da1cb1bc3a29..333e917750cf08b9b1b1c50089fd2731 List list = new ArrayList<>(passengers.size()); this.ejectPassengers(); diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java -index 06846950348954328c07f64cd9b3359e79a1a468..6fc0fd000c0fd41a8253c6829b2aa38e374b58d7 100644 +index 670090c4466d6472a83263e1769f19e3e491c927..63b09552d6e7408bc478cf452cd35c69c55f4768 100644 --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -95,8 +95,14 @@ public abstract class AbstractContainerMenu { @@ -477,7 +473,7 @@ index 06846950348954328c07f64cd9b3359e79a1a468..6fc0fd000c0fd41a8253c6829b2aa38e this.containerId = containerId; } diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java -index 25bc90eb527547487fb5191dc135f2c6030f3a19..5b3dbf15347af18065f1758c2bf06aee8af90abf 100644 +index 47862c00e9e01c7cdd5fcd808cc1b76740b85a57..9810c2ba985102667cacf110193a336513967f88 100644 --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java @@ -399,8 +399,8 @@ public final class ItemStack implements DataComponentHolder { @@ -492,10 +488,10 @@ index 25bc90eb527547487fb5191dc135f2c6030f3a19..5b3dbf15347af18065f1758c2bf06aee serverLevel.capturedBlockStates.clear(); org.bukkit.event.world.StructureGrowEvent structureEvent = null; diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 133e60d0457b3067b5cf1f9c8374b67172b0596c..55a8da685402046183d950eb6266dc48e05e5eec 100644 +index 08273e25eea77c40ef34a476870b6f4f22d9a7ad..e7a417c0a8e74dda592eb2d462b9e67cee8549db 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -166,6 +166,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -167,6 +167,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } // Paper end - add paper world config @@ -503,7 +499,7 @@ index 133e60d0457b3067b5cf1f9c8374b67172b0596c..55a8da685402046183d950eb6266dc48 public static @Nullable BlockPos lastPhysicsProblem; // Spigot private int tileTickPosition; public final Map explosionDensityCache = new java.util.HashMap<>(); // Paper - Optimize explosions -@@ -1038,6 +1039,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1039,6 +1040,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public boolean setBlock(BlockPos pos, BlockState state, int flags, int recursionLeft) { @@ -511,7 +507,7 @@ index 133e60d0457b3067b5cf1f9c8374b67172b0596c..55a8da685402046183d950eb6266dc48 // CraftBukkit start - tree generation if (this.captureTreeGeneration) { // Paper start - Protect Bedrock and End Portal/Frames from being destroyed -@@ -1417,7 +1419,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1418,7 +1420,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl tickingBlockEntity.tick(); // Paper start - rewrite chunk system if ((++tickedEntities & 7) == 0) { @@ -520,7 +516,7 @@ index 133e60d0457b3067b5cf1f9c8374b67172b0596c..55a8da685402046183d950eb6266dc48 } // Paper end - rewrite chunk system } -@@ -1439,7 +1441,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1440,7 +1442,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Paper end - Prevent block entity and entity crashes } @@ -529,7 +525,7 @@ index 133e60d0457b3067b5cf1f9c8374b67172b0596c..55a8da685402046183d950eb6266dc48 } // Paper start - Option to prevent armor stands from doing entity lookups -@@ -1581,6 +1583,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1582,6 +1584,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Nullable @Override public BlockEntity getBlockEntity(BlockPos pos) { @@ -537,7 +533,7 @@ index 133e60d0457b3067b5cf1f9c8374b67172b0596c..55a8da685402046183d950eb6266dc48 // Paper start - Perf: Optimize capturedTileEntities lookup net.minecraft.world.level.block.entity.BlockEntity blockEntity; if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(pos)) != null) { -@@ -1597,6 +1600,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1598,6 +1601,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } public void setBlockEntity(BlockEntity blockEntity) { @@ -545,7 +541,7 @@ index 133e60d0457b3067b5cf1f9c8374b67172b0596c..55a8da685402046183d950eb6266dc48 BlockPos blockPos = blockEntity.getBlockPos(); if (!this.isOutsideBuildHeight(blockPos)) { // CraftBukkit start -@@ -1682,6 +1686,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1683,6 +1687,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public List getEntities(@Nullable Entity entity, AABB boundingBox, Predicate predicate) { @@ -553,7 +549,7 @@ index 133e60d0457b3067b5cf1f9c8374b67172b0596c..55a8da685402046183d950eb6266dc48 Profiler.get().incrementCounter("getEntities"); List list = Lists.newArrayList(); -@@ -2035,8 +2040,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -2036,8 +2041,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl public abstract RecipeAccess recipeAccess(); public BlockPos getBlockRandomPos(int x, int y, int z, int yMask) { @@ -580,7 +576,7 @@ index 9711efb088bd0da9168e9bcd0496bd7caddd2974..63da283d68c7e1184d1995aeb08cd872 return value; }) diff --git a/net/minecraft/world/level/block/MushroomBlock.java b/net/minecraft/world/level/block/MushroomBlock.java -index d306f5f524dc64618df94c9783c2168dc561a5e3..72363832a60a380869b60b1ec4a352a1e11608a8 100644 +index 9176cf8c47b19d76eb49a7c00fc6723836344d4b..e6e43af7e13a6e8f8ac3b522dbdcc2186345d487 100644 --- a/net/minecraft/world/level/block/MushroomBlock.java +++ b/net/minecraft/world/level/block/MushroomBlock.java @@ -93,7 +93,7 @@ public class MushroomBlock extends VegetationBlock implements BonemealableBlock @@ -593,7 +589,7 @@ index d306f5f524dc64618df94c9783c2168dc561a5e3..72363832a60a380869b60b1ec4a352a1 return true; } else { diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index 7d7e7a87f5c9bbd9535bf2105e05d7abf08fc3dc..293877b519a8f2ac63a02823e92ba5c9d0468d30 100644 +index a07d9237d227fe6d419d8a9bc44fc623b244ad3e..3a152d634de4c660080434153f6b70e5be727b15 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -267,7 +267,7 @@ public class RedStoneWireBlock extends Block { @@ -624,7 +620,7 @@ index 7d7e7a87f5c9bbd9535bf2105e05d7abf08fc3dc..293877b519a8f2ac63a02823e92ba5c9 } } diff --git a/net/minecraft/world/level/block/SaplingBlock.java b/net/minecraft/world/level/block/SaplingBlock.java -index a5e4959c1b5133cfaeb9259d7e59b38a06453785..aa5e8d8ef47f7792b7204423f60ef4638c6d9821 100644 +index 23e9e5e7ef76fe3d6e1bbc41faf69ee65ca77d80..8b60d7b65e6cab4ad99a7df32865af6c8ef8e6b5 100644 --- a/net/minecraft/world/level/block/SaplingBlock.java +++ b/net/minecraft/world/level/block/SaplingBlock.java @@ -25,7 +25,7 @@ public class SaplingBlock extends VegetationBlock implements BonemealableBlock { @@ -665,10 +661,10 @@ index 1b2f8c4e1e362dc63fde2c7139039f0ce7eb762f..2ca4a34b3d9341f087fba031930ffd42 final org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos()); net.kyori.adventure.text.Component lockedMessage = net.kyori.adventure.text.Component.translatable("container.isLocked", io.papermc.paper.adventure.PaperAdventure.asAdventure(displayName)); diff --git a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java -index 0a94670dc20bb9c521b0395633eb100393895f6a..4ad9c47862a9791f72a18835a343bf0e962c14c8 100644 +index ab7be4298be22af32c4726f178b93896b96f599d..d78dc310002ebb4149b60a35bf514f1fd49f95c9 100644 --- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java -@@ -43,9 +43,7 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi +@@ -44,9 +44,7 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi // Paper end - Fix NPE in SculkBloomEvent world access public static void serverTick(Level level, BlockPos pos, BlockState state, SculkCatalystBlockEntity sculkCatalyst) { @@ -679,7 +675,7 @@ index 0a94670dc20bb9c521b0395633eb100393895f6a..4ad9c47862a9791f72a18835a343bf0e @Override diff --git a/net/minecraft/world/level/block/grower/TreeGrower.java b/net/minecraft/world/level/block/grower/TreeGrower.java -index d23f255de9208f42125fa358a9e8194c984fe4d3..54d64e77dc8c4bef25822d74a30be1a860cfec36 100644 +index 3efebec19a1b4fefd6071247c614693e44bc3eb4..c277a4b002d60914e7673021d3351bb4d26c574c 100644 --- a/net/minecraft/world/level/block/grower/TreeGrower.java +++ b/net/minecraft/world/level/block/grower/TreeGrower.java @@ -203,55 +203,57 @@ public final class TreeGrower { @@ -764,7 +760,7 @@ index d23f255de9208f42125fa358a9e8194c984fe4d3..54d64e77dc8c4bef25822d74a30be1a8 // CraftBukkit end } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 4dcec2e8a3120a3dfa078e8cf6857ba99ca01a2d..48f92923508802707968f9086a3bf38f0fc9a302 100644 +index de59760d27280555a334bda4f436164568cffbd6..cc194a6f3ad56e44af410bd5526af0cc767235b3 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -367,6 +367,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot diff --git a/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch b/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch index 6544540..ed53881 100644 --- a/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch +++ b/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1761,7 +_,15 @@ +@@ -1809,7 +_,15 @@ profilerFiller.push("tick"); try { diff --git a/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch b/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch index 410c20a..7e00eda 100644 --- a/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch +++ b/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -585,6 +_,12 @@ +@@ -592,6 +_,12 @@ } // Paper end - chunk tick iteration diff --git a/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 31062bd..669a6e4 100644 --- a/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/sparklypaper-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,268 +1,6 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -8,26 +_,10 @@ - import com.mojang.brigadier.StringReader; - import com.mojang.brigadier.suggestion.Suggestions; - import com.mojang.logging.LogUtils; --import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; -+import io.papermc.paper.adventure.PaperAdventure; - import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; -+import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; - import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; --import java.net.SocketAddress; --import java.util.Collections; --import java.util.EnumSet; --import java.util.HashMap; --import java.util.List; --import java.util.Map; --import java.util.Objects; --import java.util.Optional; --import java.util.Set; --import java.util.concurrent.CancellationException; --import java.util.concurrent.CompletableFuture; --import java.util.concurrent.TimeUnit; --import java.util.function.BiFunction; --import java.util.function.Consumer; --import java.util.stream.Collectors; --import java.util.stream.Stream; --import javax.annotation.Nullable; - import net.minecraft.ChatFormatting; - import net.minecraft.Util; - import net.minecraft.advancements.AdvancementHolder; -@@ -36,11 +_,7 @@ - import net.minecraft.commands.CommandSourceStack; - import net.minecraft.commands.Commands; - import net.minecraft.commands.arguments.ArgumentSignatures; --import net.minecraft.core.BlockPos; --import net.minecraft.core.Direction; --import net.minecraft.core.Holder; --import net.minecraft.core.Registry; --import net.minecraft.core.Vec3i; -+import net.minecraft.core.*; - import net.minecraft.core.component.DataComponents; - import net.minecraft.core.registries.Registries; - import net.minecraft.gametest.framework.GameTestInstance; -@@ -49,93 +_,13 @@ - import net.minecraft.network.DisconnectionDetails; - import net.minecraft.network.HashedStack; - import net.minecraft.network.TickablePacketListener; --import net.minecraft.network.chat.ChatType; --import net.minecraft.network.chat.Component; --import net.minecraft.network.chat.LastSeenMessages; --import net.minecraft.network.chat.LastSeenMessagesValidator; --import net.minecraft.network.chat.MessageSignature; --import net.minecraft.network.chat.MessageSignatureCache; --import net.minecraft.network.chat.PlayerChatMessage; --import net.minecraft.network.chat.RemoteChatSession; --import net.minecraft.network.chat.SignableCommand; --import net.minecraft.network.chat.SignedMessageBody; --import net.minecraft.network.chat.SignedMessageChain; -+import net.minecraft.network.chat.*; - import net.minecraft.network.protocol.Packet; - import net.minecraft.network.protocol.PacketUtils; - import net.minecraft.network.protocol.common.ServerboundClientInformationPacket; - import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; - import net.minecraft.network.protocol.configuration.ConfigurationProtocols; --import net.minecraft.network.protocol.game.ClientboundBlockChangedAckPacket; --import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket; --import net.minecraft.network.protocol.game.ClientboundCommandSuggestionsPacket; --import net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket; --import net.minecraft.network.protocol.game.ClientboundMoveVehiclePacket; --import net.minecraft.network.protocol.game.ClientboundPlaceGhostRecipePacket; --import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket; --import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; --import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket; --import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; --import net.minecraft.network.protocol.game.ClientboundStartConfigurationPacket; --import net.minecraft.network.protocol.game.ClientboundSystemChatPacket; --import net.minecraft.network.protocol.game.ClientboundTagQueryPacket; --import net.minecraft.network.protocol.game.ClientboundTestInstanceBlockStatus; --import net.minecraft.network.protocol.game.GameProtocols; --import net.minecraft.network.protocol.game.ServerGamePacketListener; --import net.minecraft.network.protocol.game.ServerboundAcceptTeleportationPacket; --import net.minecraft.network.protocol.game.ServerboundBlockEntityTagQueryPacket; --import net.minecraft.network.protocol.game.ServerboundChangeDifficultyPacket; --import net.minecraft.network.protocol.game.ServerboundChangeGameModePacket; --import net.minecraft.network.protocol.game.ServerboundChatAckPacket; --import net.minecraft.network.protocol.game.ServerboundChatCommandPacket; --import net.minecraft.network.protocol.game.ServerboundChatCommandSignedPacket; --import net.minecraft.network.protocol.game.ServerboundChatPacket; --import net.minecraft.network.protocol.game.ServerboundChatSessionUpdatePacket; --import net.minecraft.network.protocol.game.ServerboundChunkBatchReceivedPacket; --import net.minecraft.network.protocol.game.ServerboundClientCommandPacket; --import net.minecraft.network.protocol.game.ServerboundClientTickEndPacket; --import net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket; --import net.minecraft.network.protocol.game.ServerboundConfigurationAcknowledgedPacket; --import net.minecraft.network.protocol.game.ServerboundContainerButtonClickPacket; --import net.minecraft.network.protocol.game.ServerboundContainerClickPacket; --import net.minecraft.network.protocol.game.ServerboundContainerClosePacket; --import net.minecraft.network.protocol.game.ServerboundContainerSlotStateChangedPacket; --import net.minecraft.network.protocol.game.ServerboundDebugSubscriptionRequestPacket; --import net.minecraft.network.protocol.game.ServerboundEditBookPacket; --import net.minecraft.network.protocol.game.ServerboundEntityTagQueryPacket; --import net.minecraft.network.protocol.game.ServerboundInteractPacket; --import net.minecraft.network.protocol.game.ServerboundJigsawGeneratePacket; --import net.minecraft.network.protocol.game.ServerboundLockDifficultyPacket; --import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket; --import net.minecraft.network.protocol.game.ServerboundMoveVehiclePacket; --import net.minecraft.network.protocol.game.ServerboundPaddleBoatPacket; --import net.minecraft.network.protocol.game.ServerboundPickItemFromBlockPacket; --import net.minecraft.network.protocol.game.ServerboundPickItemFromEntityPacket; --import net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket; --import net.minecraft.network.protocol.game.ServerboundPlayerAbilitiesPacket; --import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; --import net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket; --import net.minecraft.network.protocol.game.ServerboundPlayerInputPacket; --import net.minecraft.network.protocol.game.ServerboundPlayerLoadedPacket; --import net.minecraft.network.protocol.game.ServerboundRecipeBookChangeSettingsPacket; --import net.minecraft.network.protocol.game.ServerboundRecipeBookSeenRecipePacket; --import net.minecraft.network.protocol.game.ServerboundRenameItemPacket; --import net.minecraft.network.protocol.game.ServerboundSeenAdvancementsPacket; --import net.minecraft.network.protocol.game.ServerboundSelectBundleItemPacket; --import net.minecraft.network.protocol.game.ServerboundSelectTradePacket; --import net.minecraft.network.protocol.game.ServerboundSetBeaconPacket; --import net.minecraft.network.protocol.game.ServerboundSetCarriedItemPacket; --import net.minecraft.network.protocol.game.ServerboundSetCommandBlockPacket; --import net.minecraft.network.protocol.game.ServerboundSetCommandMinecartPacket; --import net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket; --import net.minecraft.network.protocol.game.ServerboundSetJigsawBlockPacket; --import net.minecraft.network.protocol.game.ServerboundSetStructureBlockPacket; --import net.minecraft.network.protocol.game.ServerboundSetTestBlockPacket; --import net.minecraft.network.protocol.game.ServerboundSignUpdatePacket; --import net.minecraft.network.protocol.game.ServerboundSwingPacket; --import net.minecraft.network.protocol.game.ServerboundTeleportToEntityPacket; --import net.minecraft.network.protocol.game.ServerboundTestInstanceBlockActionPacket; --import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; --import net.minecraft.network.protocol.game.ServerboundUseItemPacket; -+import net.minecraft.network.protocol.game.*; - import net.minecraft.network.protocol.ping.ClientboundPongResponsePacket; - import net.minecraft.network.protocol.ping.ServerboundPingRequestPacket; - import net.minecraft.resources.ResourceKey; -@@ -144,76 +_,35 @@ - import net.minecraft.server.commands.GameModeCommand; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.server.level.ServerPlayer; --import net.minecraft.util.FutureChain; --import net.minecraft.util.Mth; --import net.minecraft.util.ProblemReporter; --import net.minecraft.util.SignatureValidator; --import net.minecraft.util.StringUtil; --import net.minecraft.util.TickThrottler; -+import net.minecraft.util.*; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.effect.MobEffects; --import net.minecraft.world.entity.Entity; --import net.minecraft.world.entity.ExperienceOrb; --import net.minecraft.world.entity.HasCustomInventoryScreen; --import net.minecraft.world.entity.LivingEntity; --import net.minecraft.world.entity.MoverType; --import net.minecraft.world.entity.PlayerRideableJumping; --import net.minecraft.world.entity.PositionMoveRotation; --import net.minecraft.world.entity.Relative; -+import net.minecraft.world.entity.*; - import net.minecraft.world.entity.item.ItemEntity; --import net.minecraft.world.entity.player.ChatVisiblity; --import net.minecraft.world.entity.player.Inventory; --import net.minecraft.world.entity.player.Player; --import net.minecraft.world.entity.player.PlayerModelPart; --import net.minecraft.world.entity.player.ProfilePublicKey; -+import net.minecraft.world.entity.player.*; - import net.minecraft.world.entity.projectile.AbstractArrow; - import net.minecraft.world.entity.vehicle.AbstractBoat; --import net.minecraft.world.inventory.AnvilMenu; --import net.minecraft.world.inventory.BeaconMenu; --import net.minecraft.world.inventory.CrafterMenu; --import net.minecraft.world.inventory.MerchantMenu; --import net.minecraft.world.inventory.RecipeBookMenu; --import net.minecraft.world.item.BlockItem; --import net.minecraft.world.item.BucketItem; --import net.minecraft.world.item.Item; --import net.minecraft.world.item.ItemStack; --import net.minecraft.world.item.Items; -+import net.minecraft.world.inventory.*; -+import net.minecraft.world.item.*; - import net.minecraft.world.item.component.WritableBookContent; - import net.minecraft.world.item.component.WrittenBookContent; - import net.minecraft.world.item.crafting.RecipeHolder; - import net.minecraft.world.item.crafting.RecipeManager; --import net.minecraft.world.level.BaseCommandBlock; --import net.minecraft.world.level.GameRules; --import net.minecraft.world.level.GameType; --import net.minecraft.world.level.Level; --import net.minecraft.world.level.LevelReader; -+import net.minecraft.world.level.*; - import net.minecraft.world.level.block.Blocks; - import net.minecraft.world.level.block.CommandBlock; --import net.minecraft.world.level.block.entity.BlockEntity; --import net.minecraft.world.level.block.entity.CommandBlockEntity; --import net.minecraft.world.level.block.entity.CrafterBlockEntity; --import net.minecraft.world.level.block.entity.JigsawBlockEntity; --import net.minecraft.world.level.block.entity.SignBlockEntity; --import net.minecraft.world.level.block.entity.StructureBlockEntity; --import net.minecraft.world.level.block.entity.TestBlockEntity; --import net.minecraft.world.level.block.entity.TestInstanceBlockEntity; --import net.minecraft.world.level.block.state.BlockBehaviour; -+import net.minecraft.world.level.block.entity.*; - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.material.Fluids; - import net.minecraft.world.level.storage.TagValueOutput; - import net.minecraft.world.phys.AABB; - import net.minecraft.world.phys.BlockHitResult; -+import net.minecraft.world.phys.HitResult; - import net.minecraft.world.phys.Vec3; - import net.minecraft.world.phys.shapes.BooleanOp; - import net.minecraft.world.phys.shapes.Shapes; - import net.minecraft.world.phys.shapes.VoxelShape; --import org.slf4j.Logger; -- --// CraftBukkit start --import io.papermc.paper.adventure.PaperAdventure; // Paper --import net.minecraft.world.inventory.Slot; --import net.minecraft.world.phys.HitResult; - import org.bukkit.Location; - import org.bukkit.NamespacedKey; - import org.bukkit.craftbukkit.entity.CraftEntity; -@@ -222,24 +_,23 @@ - import org.bukkit.craftbukkit.util.CraftLocation; - import org.bukkit.event.Event; - import org.bukkit.event.block.Action; -+import org.bukkit.event.inventory.*; - import org.bukkit.event.inventory.ClickType; --import org.bukkit.event.inventory.CraftItemEvent; --import org.bukkit.event.inventory.InventoryAction; --import org.bukkit.event.inventory.InventoryClickEvent; --import org.bukkit.event.inventory.InventoryCreativeEvent; - import org.bukkit.event.inventory.InventoryType.SlotType; --import org.bukkit.event.inventory.SmithItemEvent; --import org.bukkit.event.player.PlayerCommandPreprocessEvent; --import org.bukkit.event.player.PlayerInputEvent; --import org.bukkit.event.player.PlayerInteractAtEntityEvent; --import org.bukkit.event.player.PlayerInteractEntityEvent; --import org.bukkit.event.player.PlayerItemHeldEvent; --import org.bukkit.event.player.PlayerMoveEvent; -+import org.bukkit.event.player.*; - import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason; --import org.bukkit.event.player.PlayerSwapHandItemsEvent; --import org.bukkit.event.player.PlayerTeleportEvent; --import org.bukkit.event.player.PlayerToggleFlightEvent; --import org.bukkit.event.player.PlayerToggleSprintEvent; -+import org.slf4j.Logger; -+ -+import javax.annotation.Nullable; -+import java.net.SocketAddress; -+import java.util.*; -+import java.util.concurrent.CancellationException; -+import java.util.concurrent.CompletableFuture; -+import java.util.concurrent.TimeUnit; -+import java.util.function.BiFunction; -+import java.util.function.Consumer; -+import java.util.stream.Collectors; -+import java.util.stream.Stream; - // CraftBukkit end - - public class ServerGamePacketListenerImpl -@@ -628,6 +_,31 @@ +@@ -629,6 +_,31 @@ LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getPlainTextName(), this.player.getPlainTextName(), Math.sqrt(d7)); } @@ -294,7 +32,7 @@ // Paper start - optimise out extra getCubes boolean teleportBack = flag1; if (!teleportBack) { -@@ -1521,7 +_,7 @@ +@@ -1522,7 +_,7 @@ d3 = d - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above d4 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above d5 = d2 - this.lastGoodZ; // Paper - diff on change, used for checking large move vectors above @@ -303,7 +41,7 @@ if (this.player.onGround() && !packet.isOnGround() && flag) { // Paper start - Add PlayerJumpEvent org.bukkit.entity.Player player = this.getCraftPlayer(); -@@ -1555,7 +_,37 @@ +@@ -1556,7 +_,37 @@ boolean flag1 = this.player.verticalCollisionBelow; this.player.move(MoverType.PLAYER, new Vec3(d3, d4, d5)); @@ -342,7 +80,7 @@ final boolean didCollide = toX != this.player.getX() || toY != this.player.getY() || toZ != this.player.getZ(); // Paper - needed here as the difference in Y can be reset - also note: this is only a guess at whether collisions took place, floating point errors can make this true when it shouldn't be... // Paper start - prevent position desync if (this.awaitingPositionFromClient != null) { -@@ -1688,14 +_,14 @@ +@@ -1689,14 +_,14 @@ && this.noBlocksAround(this.player); this.player.level().getChunkSource().move(this.player); Vec3 vec3 = new Vec3(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z); @@ -360,7 +98,7 @@ || this.player.hasLandedInLiquid() || this.player.onClimbable() || this.player.isSpectator() -@@ -1710,7 +_,7 @@ +@@ -1711,7 +_,7 @@ this.lastGoodZ = this.player.getZ(); } else { this.internalTeleport(x, y, z, f, f1); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet. @@ -369,7 +107,7 @@ this.player.removeLatestMovementRecording(); } } -@@ -3192,6 +_,21 @@ +@@ -3193,6 +_,21 @@ } else { event = new CraftItemEvent(recipe, inventory, type, slotNum, click, action); } diff --git a/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch b/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch index 5f25143..debf3ea 100644 --- a/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch +++ b/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -1925,6 +_,12 @@ +@@ -1926,6 +_,12 @@ if (!(shootable.getItem() instanceof ProjectileWeaponItem)) { return ItemStack.EMPTY; } else { diff --git a/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch b/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch index e25f2c7..eb12185 100644 --- a/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch +++ b/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -111,7 +_,7 @@ +@@ -112,7 +_,7 @@ .add(new ExplosionParticleInfo(ParticleTypes.POOF, 0.5F, 1.0F)) .add(new ExplosionParticleInfo(ParticleTypes.SMOKE, 1.0F, 1.0F)) .build(); @@ -9,7 +9,7 @@ protected final CollectingNeighborUpdater neighborUpdater; private final List pendingBlockEntityTickers = Lists.newArrayList(); private boolean tickingBlockEntities; -@@ -139,6 +_,7 @@ +@@ -140,6 +_,7 @@ // CraftBukkit start public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray @@ -17,7 +17,7 @@ private final CraftWorld world; public net.kyori.adventure.util.TriState pvpMode = net.kyori.adventure.util.TriState.NOT_SET; public @Nullable org.bukkit.generator.ChunkGenerator generator; -@@ -845,6 +_,7 @@ +@@ -846,6 +_,7 @@ // Paper end - getblock optimisations - cache world height/sections this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config @@ -25,7 +25,7 @@ this.generator = generator; this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment); -@@ -1406,13 +_,11 @@ +@@ -1407,13 +_,11 @@ boolean runsNormally = this.tickRateManager().runsNormally(); int tickedEntities = 0; // Paper - rewrite chunk system @@ -40,7 +40,7 @@ } else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) { tickingBlockEntity.tick(); // Paper start - rewrite chunk system -@@ -1422,7 +_,7 @@ +@@ -1423,7 +_,7 @@ // Paper end - rewrite chunk system } } diff --git a/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/level/block/CrafterBlock.java.patch b/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/level/block/CrafterBlock.java.patch index ac94560..a981577 100644 --- a/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/level/block/CrafterBlock.java.patch +++ b/sparklypaper-server/minecraft-patches/sources/net/minecraft/world/level/block/CrafterBlock.java.patch @@ -11,5 +11,5 @@ + itemStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(sparklyEvent.getResult()); + // SparklyPaper end if (itemStack.isEmpty()) { - level.levelEvent(1050, pos, 0); + level.levelEvent(LevelEvent.SOUND_CRAFTER_FAIL, pos, 0); } else {