diff --git a/gradle.properties b/gradle.properties index f273154..eae10e1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ group=me.samsuik.sakura -version=1.21.5-R0.1-SNAPSHOT -mcVersion=1.21.5 +version=1.21.6-R0.1-SNAPSHOT +mcVersion=1.21.6 -paperRef=a1b30587d9d5a5d9bf1530f7d1e289f2e29991b6 +paperRef=4e1a2555be7ff1e6960714ee7fbabc13fa25d4c2 org.gradle.jvmargs=-Xmx2G org.gradle.vfs.watch=false diff --git a/sakura-api/src/main/java/me/samsuik/sakura/physics/PhysicsVersion.java b/sakura-api/src/main/java/me/samsuik/sakura/physics/PhysicsVersion.java index 07872e5..2de50d6 100644 --- a/sakura-api/src/main/java/me/samsuik/sakura/physics/PhysicsVersion.java +++ b/sakura-api/src/main/java/me/samsuik/sakura/physics/PhysicsVersion.java @@ -19,6 +19,7 @@ public enum PhysicsVersion { v1_20("1.20", 1_20_0), v1_21_2("1.21.2", 1_21_2), v1_21_5("1.21.5", 1_21_5), + v1_21_6("1.21.6", 1_21_6), LATEST("latest", 9_99_9); // latest version private final String friendlyName; diff --git a/sakura-server/build.gradle.kts.patch b/sakura-server/build.gradle.kts.patch index 0c58ef9..f70bad4 100644 --- a/sakura-server/build.gradle.kts.patch +++ b/sakura-server/build.gradle.kts.patch @@ -1,14 +1,14 @@ --- a/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts -@@ -13,6 +_,7 @@ +@@ -15,6 +_,7 @@ } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" +val serverBrand = rootProject.name dependencies { - mache("io.papermc:mache:1.21.5+build.2") -@@ -24,6 +_,17 @@ + mache("io.papermc:mache:1.21.6+build.1") +@@ -26,6 +_,17 @@ minecraftVersion = providers.gradleProperty("mcVersion") gitFilePatches = false @@ -23,10 +23,10 @@ + + activeFork = fork + - //updatingMinecraft { - // oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365" - //} -@@ -108,7 +_,20 @@ + spigot { + enabled = true + buildDataRef = "281ac0de7a76d808753ede97d11b034bc801b63d" +@@ -107,7 +_,20 @@ } } @@ -48,7 +48,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { extendsFrom(configurations.compileClasspath.get()) } -@@ -130,7 +_,7 @@ +@@ -129,7 +_,7 @@ } dependencies { @@ -57,7 +57,7 @@ implementation("ca.spottedleaf:concurrentutil:0.0.3") 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 -@@ -213,7 +_,7 @@ +@@ -212,7 +_,7 @@ "Specification-Version" to project.version, "Specification-Vendor" to "Paper Team", "Brand-Id" to "papermc:paper", @@ -66,7 +66,7 @@ "Build-Number" to (build ?: ""), "Build-Time" to buildTime.toString(), "Git-Branch" to gitBranch, -@@ -267,7 +_,7 @@ +@@ -271,7 +_,7 @@ jvmArgumentProviders.add(provider) } diff --git a/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch b/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch index 5696968..b1298bb 100644 --- a/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch +++ b/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Track block changes and level tick scheduler diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 40c906959d2708bf3e589f8e8d541d47106a8465..b234215e59ac303ef7979031ab1b042ff6692b7a 100644 +index c86973892e2af63911eef1a00ea957eb33a96a03..1ade8d6da1a28044a354699293f4cfbda6133008 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1747,6 +1747,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, AutoCl @@ -32,10 +32,10 @@ index 787d7a76af7dfcaaa4b329df2cbe7cfcaa83d572..8aea98378fccb14f3eadab72a38e5661 protected Level( WritableLevelData levelData, diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 5d3fc807221392d378fec283bfdefb8747fb8376..cfc125d43cf3702d46c221f4e7b0d66a15c5d690 100644 +index 75578e6ed7233a03d9b6cd3c6d3997f1c6148392..a2185062fbb123549be21e37e84541d61ec301c9 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -127,6 +127,21 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -129,6 +129,21 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p return this.getBlockStateFinal(x, y, z); } // Paper end - get block chunk optimisation @@ -57,7 +57,7 @@ index 5d3fc807221392d378fec283bfdefb8747fb8376..cfc125d43cf3702d46c221f4e7b0d66a public LevelChunk(Level level, ChunkPos pos) { this(level, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, null, null, null); -@@ -164,6 +179,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -166,6 +181,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p this.debug = !empty && this.level.isDebug(); this.defaultBlockState = empty ? VOID_AIR_BLOCKSTATE : AIR_BLOCKSTATE; // Paper end - get block chunk optimisation @@ -65,7 +65,7 @@ index 5d3fc807221392d378fec283bfdefb8747fb8376..cfc125d43cf3702d46c221f4e7b0d66a } public LevelChunk(ServerLevel level, ProtoChunk chunk, @Nullable LevelChunk.PostLoadProcessor postLoad) { -@@ -412,6 +428,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -414,6 +430,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p if (!section.getBlockState(i, i1, i2).is(block)) { return null; } else { diff --git a/sakura-server/minecraft-patches/features/0002-Client-Visibility-Settings.patch b/sakura-server/minecraft-patches/features/0002-Client-Visibility-Settings.patch index 3188cef..334626d 100644 --- a/sakura-server/minecraft-patches/features/0002-Client-Visibility-Settings.patch +++ b/sakura-server/minecraft-patches/features/0002-Client-Visibility-Settings.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Client Visibility Settings diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index dff3cc7456fe69ebd735aa950f79ce0dfed7e25e..07d8bb89ed0f9cea6353905939ba9f91c6fb64a5 100644 +index df822f0e7c358d74737c749d6ba61ec31846a569..a88184f63f3cb539569942c5c982193973183984 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java @@ -173,6 +173,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -78,10 +78,10 @@ index dff3cc7456fe69ebd735aa950f79ce0dfed7e25e..07d8bb89ed0f9cea6353905939ba9f91 if (flag && !player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { // Paper - only consider hits flag = false; diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 6fa053b317fa51d0bf25a6d3f48addc55452257e..c5fffb6ca4ef4d447e4eb668e8980fe0885d99da 100644 +index 03a157f6c96b0f39effa24ae278eeac689c83ee8..5f38281763419123a0611cbb34d9a02a0e0302ea 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -561,6 +561,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -564,6 +564,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.playerTickingChunks.remove((LevelChunk)chunkHolder.getCurrentChunk()); } // Paper end - chunk tick iteration @@ -103,7 +103,7 @@ index 6fa053b317fa51d0bf25a6d3f48addc55452257e..c5fffb6ca4ef4d447e4eb668e8980fe0 public ServerLevel( MinecraftServer server, -@@ -671,6 +686,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -675,6 +690,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 @@ -111,7 +111,7 @@ index 6fa053b317fa51d0bf25a6d3f48addc55452257e..c5fffb6ca4ef4d447e4eb668e8980fe0 } // Paper start -@@ -1876,7 +1892,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1898,7 +1914,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe for (ServerPlayer serverPlayer : this.players) { if (serverPlayer.distanceToSqr(vec3) < 4096.0) { Optional optional = Optional.ofNullable(serverExplosion.getHitPlayers().get(serverPlayer)); @@ -132,22 +132,22 @@ index 6fa053b317fa51d0bf25a6d3f48addc55452257e..c5fffb6ca4ef4d447e4eb668e8980fe0 } diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 531336f7c09e74ed60f7c697c26a9639a9ea489c..5c7bb1ff36fe9d91958eda88a2631b7d60659fb2 100644 +index 94da87a5f468b0b4c80d63054e6184417d2c7b76..d5fdc43302fdbed0a6e83b6033fb05baa8b6445e 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -451,6 +451,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc - return this.viewDistanceHolder; +@@ -526,6 +526,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + } } - // Paper end - rewrite chunk system + // Paper end - improve keepalives + public final me.samsuik.sakura.player.visibility.PlayerVisibilitySettings visibilitySettings = new me.samsuik.sakura.player.visibility.PlayerVisibilitySettings(); // Sakura - client visibility settings public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) { - super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile); + super(level, gameProfile); diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 186393485396cfe9b1baef29586198356e2d2600..a06f5a9b577cd9cc2cb948b2801b0aec31db8836 100644 +index 43f70a5561d6cc62aaeba6d1e39598ecb382e369..6ccc1cd38ccc4f346caad807db84b83a1c0f55dc 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -51,6 +51,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -53,6 +53,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack public final java.util.Map packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit protected static final net.minecraft.resources.ResourceLocation MINECRAFT_BRAND = net.minecraft.resources.ResourceLocation.withDefaultNamespace("brand"); // Paper - Brand support @@ -169,7 +169,7 @@ index 186393485396cfe9b1baef29586198356e2d2600..a06f5a9b577cd9cc2cb948b2801b0aec public ServerCommonPacketListenerImpl(MinecraftServer server, Connection connection, CommonListenerCookie cookie, net.minecraft.server.level.ServerPlayer player) { // CraftBukkit this.server = server; -@@ -291,6 +306,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -330,6 +345,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } else if (packet instanceof net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket defaultSpawnPositionPacket) { this.player.compassTarget = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(defaultSpawnPositionPacket.getPos(), this.getCraftPlayer().getWorld()); } @@ -182,7 +182,7 @@ index 186393485396cfe9b1baef29586198356e2d2600..a06f5a9b577cd9cc2cb948b2801b0aec // CraftBukkit end if (packet.isTerminal()) { this.close(); -@@ -303,7 +324,10 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -342,7 +363,10 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } catch (Throwable var7) { CrashReport crashReport = CrashReport.forThrowable(var7, "Sending packet"); CrashReportCategory crashReportCategory = crashReport.addCategory("Packet being sent"); @@ -195,10 +195,10 @@ index 186393485396cfe9b1baef29586198356e2d2600..a06f5a9b577cd9cc2cb948b2801b0aec } } diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9041830c19e2899479e1519488faba5c416ccd88..2708d162c24e1d446485cd49f7b47abc0bcd5054 100644 +index 625eae18ab13ae27949128f6325b3608a557cf1f..74c11280979d170a635a997c3a3acf489b3eaa6a 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3192,6 +3192,7 @@ public class ServerGamePacketListenerImpl +@@ -3204,6 +3204,7 @@ public class ServerGamePacketListenerImpl event.setCancelled(cancelled); net.minecraft.world.inventory.AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224 @@ -207,10 +207,10 @@ index 9041830c19e2899479e1519488faba5c416ccd88..2708d162c24e1d446485cd49f7b47abc if (this.player.containerMenu != oldContainer) { return; diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index d96d493b3d14cf84a7ecf0d531aa35d41a801601..92fd4bb2b2473a0630cd5edf8d301dc7c60b2998 100644 +index 46461fae4d4472bfdae75d12ac9cdaecafef848e..057ed507b8f8d6c45a8a49458d087d892ec29d8a 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -516,6 +516,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -533,6 +533,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper end - optimise entity tracker public boolean pushedByFluid = true; // Sakura - entity pushed by fluid api @@ -222,10 +222,10 @@ index d96d493b3d14cf84a7ecf0d531aa35d41a801601..92fd4bb2b2473a0630cd5edf8d301dc7 public Entity(EntityType entityType, Level level) { this.type = entityType; diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 5b036edf61c53596528bf722c46673b47c01f51d..6660e6c78303db5585a06d6836b035d0e8582922 100644 +index ae1f7a8b9cc6db4dd8dd3d6593a952166d35cc68..f7663d07a71582c332b38871211e648cffcf13c2 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -76,6 +76,7 @@ public class FallingBlockEntity extends Entity { +@@ -79,6 +79,7 @@ public class FallingBlockEntity extends Entity { super(entityType, level); this.dropItem = level.sakuraConfig().cannons.sand.dropItems; // Sakura - configure falling blocks dropping items this.heightParity = level.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura - configure cannon mechanics @@ -234,10 +234,10 @@ index 5b036edf61c53596528bf722c46673b47c01f51d..6660e6c78303db5585a06d6836b035d0 public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index deb5e9e4cdd235311ff4e51ffb2f02f35d580645..7e3d7d5b47557e57bf661aa8d3eefcb416cb408b 100644 +index dc9c8bdc81dec07a8e457431bbd35a54236b03ef..8755c76b679adcacbdd8e2faec363745fd583e48 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -64,6 +64,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -63,6 +63,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { public PrimedTnt(EntityType entityType, Level level) { super(entityType, level); this.blocksBuilding = true; diff --git a/sakura-server/minecraft-patches/features/0003-Load-Chunks-on-Movement.patch b/sakura-server/minecraft-patches/features/0003-Load-Chunks-on-Movement.patch index 2378b75..3283f38 100644 --- a/sakura-server/minecraft-patches/features/0003-Load-Chunks-on-Movement.patch +++ b/sakura-server/minecraft-patches/features/0003-Load-Chunks-on-Movement.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Load Chunks on Movement diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java -index a97a2a8492f3858e3b622d26768b4d819c9b47a7..44aaaa87d63a2a2287f89feaa431ca0e80da3dab 100644 +index 01cd38bba2deb6cf65c82b4e4ec352a2998fd339..548e3dc8e5fee004483b40a59e2502ba8b93e674 100644 --- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java @@ -1885,6 +1885,7 @@ public final class CollisionUtil { @@ -39,10 +39,10 @@ index a97a2a8492f3858e3b622d26768b4d819c9b47a7..44aaaa87d63a2a2287f89feaa431ca0e // bound y diff --git a/net/minecraft/server/level/TicketType.java b/net/minecraft/server/level/TicketType.java -index f91eed907ffc61a4092aabaa0a1b061c2c453673..0159517f425491ce490d982a09e40efd4ce7868c 100644 +index 6a7dae136691fb2476633fa12897424daa6bb5b3..7af093dbbcb91ef0e2587f8cd932bcfbca4fc9dc 100644 --- a/net/minecraft/server/level/TicketType.java +++ b/net/minecraft/server/level/TicketType.java -@@ -51,6 +51,7 @@ public final class TicketType implements ca.spottedleaf.moonrise.patches.chun +@@ -56,6 +56,7 @@ public final class TicketType implements ca.spottedleaf.moonrise.patches.chun public static final TicketType PLUGIN_TICKET = register("plugin_ticket", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING_AND_SIMULATION); static { ((TicketType)PLUGIN_TICKET).moonrise$setIdentifierComparator((org.bukkit.plugin.Plugin p1, org.bukkit.plugin.Plugin p2) -> p1.getName().compareTo(p2.getName())); } // Paper // Paper - rewrite chunk system public static final TicketType FUTURE_AWAIT = register("future_await", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING_AND_SIMULATION); // Paper public static final TicketType CHUNK_LOAD = register("chunk_load", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING); // Paper - moonrise @@ -51,10 +51,10 @@ index f91eed907ffc61a4092aabaa0a1b061c2c453673..0159517f425491ce490d982a09e40efd public static TicketType register(String name, long timeout, boolean persist, TicketType.TicketUse use) { return Registry.register(BuiltInRegistries.TICKET_TYPE, name, new TicketType(timeout, persist, use)); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 92fd4bb2b2473a0630cd5edf8d301dc7c60b2998..ccd0497ec6587086e6d2f8da0f8d0ae606449d37 100644 +index 057ed507b8f8d6c45a8a49458d087d892ec29d8a..dcfe52f72efde7c2e9cbdb611d5e72bf4aaaeb23 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -520,6 +520,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -537,6 +537,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public boolean isPrimedTNT; public boolean isFallingBlock; // Sakura end - client visibility settings @@ -75,7 +75,7 @@ index 92fd4bb2b2473a0630cd5edf8d301dc7c60b2998..ccd0497ec6587086e6d2f8da0f8d0ae6 public Entity(EntityType entityType, Level level) { this.type = entityType; -@@ -1491,7 +1505,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1520,7 +1534,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getCollisionsForBlocksOrWorldBorder( this.level, (Entity)(Object)this, initialCollisionBox, potentialCollisionsVoxel, potentialCollisionsBB, @@ -84,7 +84,7 @@ index 92fd4bb2b2473a0630cd5edf8d301dc7c60b2998..ccd0497ec6587086e6d2f8da0f8d0ae6 ); potentialCollisionsBB.addAll(entityAABBs); final Vec3 collided = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.performCollisions(movement, currentBox, potentialCollisionsVoxel, potentialCollisionsBB); -@@ -4952,13 +4966,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -5184,13 +5198,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Override public boolean shouldBeSaved() { return (this.removalReason == null || this.removalReason.shouldSave()) @@ -101,10 +101,10 @@ index 92fd4bb2b2473a0630cd5edf8d301dc7c60b2998..ccd0497ec6587086e6d2f8da0f8d0ae6 public boolean mayInteract(ServerLevel level, BlockPos pos) { diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 6660e6c78303db5585a06d6836b035d0e8582922..b6a2da9d6db99f107fa8d9703b77515cf112a604 100644 +index f7663d07a71582c332b38871211e648cffcf13c2..e4dce2b09e8e898166b355373e6a205ebeb53a25 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -77,6 +77,7 @@ public class FallingBlockEntity extends Entity { +@@ -80,6 +80,7 @@ public class FallingBlockEntity extends Entity { this.dropItem = level.sakuraConfig().cannons.sand.dropItems; // Sakura - configure falling blocks dropping items this.heightParity = level.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura - configure cannon mechanics this.isFallingBlock = true; // Sakura - client visibility settings @@ -113,10 +113,10 @@ index 6660e6c78303db5585a06d6836b035d0e8582922..b6a2da9d6db99f107fa8d9703b77515c public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index 7e3d7d5b47557e57bf661aa8d3eefcb416cb408b..55dbe5baf2df0111d03a43d32208798d7ec670a1 100644 +index 8755c76b679adcacbdd8e2faec363745fd583e48..2420999c5399333bed122ee0a1f252ac894adfcb 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -65,6 +65,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -64,6 +64,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { super(entityType, level); this.blocksBuilding = true; this.isPrimedTNT = true; // Sakura - client visibility settings @@ -125,10 +125,10 @@ index 7e3d7d5b47557e57bf661aa8d3eefcb416cb408b..55dbe5baf2df0111d03a43d32208798d public PrimedTnt(Level level, double x, double y, double z, @Nullable LivingEntity owner) { diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java -index 3b7f0d5fe40bdda65ab859a0c22bf0d369dc0f01..dd50e4867b16127355243acdb9ba647a4b50baae 100644 +index 182c14b660f8860bed627eed4e01fd4002153e9a..c3074cdbfb584b6d033377d7407177a344f68a3c 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -138,6 +138,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -139,6 +139,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh private final int minSection; private final int maxSection; // Paper end - get block chunk optimisation diff --git a/sakura-server/minecraft-patches/features/0004-Slice-Packet-obfuscation-and-reduction.patch b/sakura-server/minecraft-patches/features/0004-Slice-Packet-obfuscation-and-reduction.patch index 3346207..ebe18c6 100644 --- a/sakura-server/minecraft-patches/features/0004-Slice-Packet-obfuscation-and-reduction.patch +++ b/sakura-server/minecraft-patches/features/0004-Slice-Packet-obfuscation-and-reduction.patch @@ -123,7 +123,7 @@ index f1ab0e66e7d464f7f31a7a360528ed97cdda0aa0..4aed59c3038cb4af7e454a0dd8455488 public DataItem(EntityDataAccessor accessor, T value) { this.accessor = accessor; diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index b118e91f1e0b5a8b8c0b2a4a32faabc5a34a5954..b26b47afe4533d223d0079e4733ef0172121cc9d 100644 +index e96d4dee14c05f2fa329bfb1588ec795d4e3d730..ba9393e474ae213316c693d73ef2641e69eae8cc 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java @@ -148,7 +148,7 @@ public class ServerEntity { @@ -135,7 +135,7 @@ index b118e91f1e0b5a8b8c0b2a4a32faabc5a34a5954..b26b47afe4533d223d0079e4733ef017 byte b = Mth.packDegrees(this.entity.getYRot()); byte b1 = Mth.packDegrees(this.entity.getXRot()); boolean flag = Math.abs(b - this.lastSentYRot) >= 1 || Math.abs(b1 - this.lastSentXRot) >= 1; -@@ -417,7 +417,15 @@ public class ServerEntity { +@@ -411,7 +411,15 @@ public class ServerEntity { List> list = entityData.packDirty(); if (list != null) { this.trackedDataValues = entityData.getNonDefaultValues(); @@ -153,10 +153,10 @@ index b118e91f1e0b5a8b8c0b2a4a32faabc5a34a5954..b26b47afe4533d223d0079e4733ef017 if (this.entity instanceof LivingEntity) { diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index ccd0497ec6587086e6d2f8da0f8d0ae606449d37..3c638e9039a037d20c008f22f0c5bace3d3493c6 100644 +index dcfe52f72efde7c2e9cbdb611d5e72bf4aaaeb23..ce39193b14b43c215930cde7c311f88f756b0b81 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -3444,7 +3444,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3639,7 +3639,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID); return; } @@ -166,10 +166,10 @@ index ccd0497ec6587086e6d2f8da0f8d0ae606449d37..3c638e9039a037d20c008f22f0c5bace } diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index b6a2da9d6db99f107fa8d9703b77515cf112a604..45f08a65d8b423fbf69f66d695bb9d67cf0f2f23 100644 +index e4dce2b09e8e898166b355373e6a205ebeb53a25..860efa7bf6643ab9f05e97fefec280dffa76ba0e 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -142,7 +142,7 @@ public class FallingBlockEntity extends Entity { +@@ -145,7 +145,7 @@ public class FallingBlockEntity extends Entity { } public void setStartPos(BlockPos startPos) { @@ -179,10 +179,10 @@ index b6a2da9d6db99f107fa8d9703b77515cf112a604..45f08a65d8b423fbf69f66d695bb9d67 public BlockPos getStartPos() { diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index 55dbe5baf2df0111d03a43d32208798d7ec670a1..0fbac85dd7b624899db3825149a5d2b167ecedaa 100644 +index 2420999c5399333bed122ee0a1f252ac894adfcb..2e7f6e3941b34323768e43870541c8e4156c9a8f 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -243,7 +243,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -228,7 +228,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { } public void setFuse(int life) { @@ -196,10 +196,10 @@ index 55dbe5baf2df0111d03a43d32208798d7ec670a1..0fbac85dd7b624899db3825149a5d2b1 public int getFuse() { diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java -index 3e17e814d6469e5498add774220ec8b568d09094..2f67228654ab841f26ffb336420d9c4baaaf2442 100644 +index 9b1b7385b823e97a5a6e059c75a68cadc190e967..eca187bf6e3ccb55ce78ee341d4efafc9a728612 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -679,7 +679,7 @@ public abstract class Player extends LivingEntity { +@@ -689,7 +689,7 @@ public abstract class Player extends LivingEntity { public void increaseScore(int score) { int score1 = this.getScore(); diff --git a/sakura-server/minecraft-patches/features/0006-Optimise-paper-explosions.patch b/sakura-server/minecraft-patches/features/0006-Optimise-paper-explosions.patch index 294a10c..38e7bdd 100644 --- a/sakura-server/minecraft-patches/features/0006-Optimise-paper-explosions.patch +++ b/sakura-server/minecraft-patches/features/0006-Optimise-paper-explosions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimise paper explosions diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java -index ba20e87d2105ce53cdaf4049de2388d05fcd1b56..6e3a429bc165d8473ea50ee2ae1548270db599d1 100644 +index b2bcfb3557a0326fd7ec1059f95d6da4568dfd80..bd2055bc89c5672b514f1f7b1ad320a2fba7cbe2 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java -@@ -297,6 +297,12 @@ public final class ChunkEntitySlices { +@@ -319,6 +319,12 @@ public final class ChunkEntitySlices { return true; } @@ -21,7 +21,7 @@ index ba20e87d2105ce53cdaf4049de2388d05fcd1b56..6e3a429bc165d8473ea50ee2ae154827 public void getHardCollidingEntities(final Entity except, final AABB box, final List into, final Predicate predicate) { this.hardCollidingEntities.getEntities(except, box, into, predicate); } -@@ -495,6 +501,17 @@ public final class ChunkEntitySlices { +@@ -517,6 +523,17 @@ public final class ChunkEntitySlices { } } @@ -40,7 +40,7 @@ index ba20e87d2105ce53cdaf4049de2388d05fcd1b56..6e3a429bc165d8473ea50ee2ae154827 if (this.count == 0) { return; diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c97980fbfa4dc 100644 +index 250a46dbfdf3ba751dc081fae5cbf8aa16153f4e..1e9b92454edae054c6c3c50dc844c8fc3689f6f8 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -86,7 +86,7 @@ public class ServerExplosion implements Explosion { @@ -92,7 +92,7 @@ index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c9798 public ServerExplosion( ServerLevel level, -@@ -395,6 +428,12 @@ public class ServerExplosion implements Explosion { +@@ -398,6 +431,12 @@ public class ServerExplosion implements Explosion { initialCache = this.getOrCacheExplosionBlock(blockX, blockY, blockZ, key, true); } @@ -105,7 +105,7 @@ index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c9798 // only ~1/3rd of the loop iterations in vanilla will result in a ray, as it is iterating the perimeter of // a 16x16x16 cube // we can cache the rays and their normals as well, so that we eliminate the excess iterations / checks and -@@ -473,16 +512,55 @@ public class ServerExplosion implements Explosion { +@@ -476,16 +515,55 @@ public class ServerExplosion implements Explosion { // Paper end - collision optimisations } @@ -165,7 +165,7 @@ index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c9798 if (!entity.ignoreExplosion(this)) { double d = Math.sqrt(entity.distanceToSqr(this.center)) / f; if (d <= 1.0) { -@@ -507,15 +585,16 @@ public class ServerExplosion implements Explosion { +@@ -510,15 +588,16 @@ public class ServerExplosion implements Explosion { // - Damaging EnderDragon does nothing // - EnderDragon hitbox always covers the other parts and is therefore always present if (entity instanceof EnderDragonPart) { @@ -184,7 +184,7 @@ index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c9798 dragonPart.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, dragonPart, f1)); } } -@@ -524,7 +603,7 @@ public class ServerExplosion implements Explosion { +@@ -527,7 +606,7 @@ public class ServerExplosion implements Explosion { } if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled diff --git a/sakura-server/minecraft-patches/features/0007-Store-Entity-Data-State.patch b/sakura-server/minecraft-patches/features/0007-Store-Entity-Data-State.patch index 95f639b..61689f0 100644 --- a/sakura-server/minecraft-patches/features/0007-Store-Entity-Data-State.patch +++ b/sakura-server/minecraft-patches/features/0007-Store-Entity-Data-State.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Store Entity Data/State diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 3c638e9039a037d20c008f22f0c5bace3d3493c6..cffd3f64b253dba53eacc60c8ae82dd297f98e5b 100644 +index ce39193b14b43c215930cde7c311f88f756b0b81..f8b1b6850013b70218aa2eefe9371774a45a6033 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -534,6 +534,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -551,6 +551,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return flags; } // Sakura end - load chunks on movement @@ -31,7 +31,7 @@ index 3c638e9039a037d20c008f22f0c5bace3d3493c6..cffd3f64b253dba53eacc60c8ae82dd2 public Entity(EntityType entityType, Level level) { this.type = entityType; diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 0e676210ef390e3cce2fc24622f68da119c9a05f..7bf2b9a5a6c0a5c78e8623e158367552eb253fbc 100644 +index 7aa8d68800cdec91f24f015f9b2d56e969a7be17..2fa0725a2b41517e1589e540999118f5c355e899 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -1498,6 +1498,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl diff --git a/sakura-server/minecraft-patches/features/0008-Merge-Cannon-Entities.patch b/sakura-server/minecraft-patches/features/0008-Merge-Cannon-Entities.patch index aeaaf4f..664e4f4 100644 --- a/sakura-server/minecraft-patches/features/0008-Merge-Cannon-Entities.patch +++ b/sakura-server/minecraft-patches/features/0008-Merge-Cannon-Entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Merge Cannon Entities diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index c5fffb6ca4ef4d447e4eb668e8980fe0885d99da..939264c895f452e909cfbff19eced2cfc904ee6a 100644 +index 5f38281763419123a0611cbb34d9a02a0e0302ea..5ddfbddbef13b58bf509e4c60bbd72cde2a7f59d 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -687,6 +687,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -691,6 +691,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper end - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings @@ -16,7 +16,7 @@ index c5fffb6ca4ef4d447e4eb668e8980fe0885d99da..939264c895f452e909cfbff19eced2cf } // Paper start -@@ -801,6 +802,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -805,6 +806,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR @@ -24,7 +24,7 @@ index c5fffb6ca4ef4d447e4eb668e8980fe0885d99da..939264c895f452e909cfbff19eced2cf this.entityTickList .forEach( entity -> { -@@ -819,6 +821,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -823,6 +825,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity.stopRiding(); } @@ -41,10 +41,10 @@ index c5fffb6ca4ef4d447e4eb668e8980fe0885d99da..939264c895f452e909cfbff19eced2cf this.guardEntityTick(this::tickNonPassenger, entity); profilerFiller.pop(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index cffd3f64b253dba53eacc60c8ae82dd297f98e5b..68e2b26835a2588a047e9ea175eb8e4912041976 100644 +index f8b1b6850013b70218aa2eefe9371774a45a6033..46843fb00310923dc4da31e4554a40696eba57b8 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -549,6 +549,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -566,6 +566,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return to.entityState() != null && to.entityState().comparePositionAndMotion(this); } // Sakura end - store entity data/state @@ -72,7 +72,7 @@ index cffd3f64b253dba53eacc60c8ae82dd297f98e5b..68e2b26835a2588a047e9ea175eb8e49 public Entity(EntityType entityType, Level level) { this.type = entityType; -@@ -4951,6 +4972,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -5178,6 +5199,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (this.removalReason != Entity.RemovalReason.UNLOADED_TO_CHUNK) { this.getPassengers().forEach(Entity::stopRiding); } // Paper - rewrite chunk system this.levelCallback.onRemove(removalReason); this.onRemoval(removalReason); @@ -85,10 +85,10 @@ index cffd3f64b253dba53eacc60c8ae82dd297f98e5b..68e2b26835a2588a047e9ea175eb8e49 if (!(this instanceof ServerPlayer) && removalReason != RemovalReason.CHANGED_DIMENSION && !alreadyRemoved) { // Players need to be special cased, because they are regularly removed from the world diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 45f08a65d8b423fbf69f66d695bb9d67cf0f2f23..3af6e04bb4dcd91de2794bbc8d3eff16def9efa8 100644 +index 860efa7bf6643ab9f05e97fefec280dffa76ba0e..d65df5f13e038d109870d1f7fba50d2260489d49 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -50,7 +50,7 @@ import net.minecraft.world.phys.HitResult; +@@ -53,7 +53,7 @@ import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import org.slf4j.Logger; @@ -97,7 +97,7 @@ index 45f08a65d8b423fbf69f66d695bb9d67cf0f2f23..3af6e04bb4dcd91de2794bbc8d3eff16 private static final Logger LOGGER = LogUtils.getLogger(); private static final BlockState DEFAULT_BLOCK_STATE = Blocks.SAND.defaultBlockState(); private static final int DEFAULT_TIME = 0; -@@ -72,12 +72,63 @@ public class FallingBlockEntity extends Entity { +@@ -75,12 +75,63 @@ public class FallingBlockEntity extends Entity { public boolean autoExpire = true; // Paper - Expand FallingBlock API public boolean heightParity; // Sakura - falling block height parity api @@ -161,7 +161,7 @@ index 45f08a65d8b423fbf69f66d695bb9d67cf0f2f23..3af6e04bb4dcd91de2794bbc8d3eff16 } public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { -@@ -237,6 +288,7 @@ public class FallingBlockEntity extends Entity { +@@ -240,6 +291,7 @@ public class FallingBlockEntity extends Entity { return; } // CraftBukkit end @@ -169,27 +169,31 @@ index 45f08a65d8b423fbf69f66d695bb9d67cf0f2f23..3af6e04bb4dcd91de2794bbc8d3eff16 if (this.level().setBlock(blockPos, this.blockState, 3)) { ((ServerLevel)this.level()) .getChunkSource() -@@ -341,6 +393,7 @@ public class FallingBlockEntity extends Entity { +@@ -347,6 +399,11 @@ public class FallingBlockEntity extends Entity { - compound.putBoolean("CancelDrop", this.cancelDrop); - if (!this.autoExpire) compound.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API -+ compound.putInt("merge_count", this.mergeData.count); // Sakura - merge cannon entities; save to nbt + output.putBoolean("CancelDrop", this.cancelDrop); + if (!this.autoExpire) output.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API ++ // Sakura start - merge cannon entities; save to nbt ++ if (this.mergeData.count != 1) { ++ output.putInt("merge_count", this.mergeData.count); ++ } ++ // Sakura end - merge cannon entities; save to nbt } @Override -@@ -356,6 +409,7 @@ public class FallingBlockEntity extends Entity { - this.blockData = compound.getCompound("TileEntityData").map(blockData -> this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock ? null : blockData).map(CompoundTag::copy).orElse(null); // Paper - Filter bad block entity nbt data from falling blocks - this.cancelDrop = compound.getBooleanOr("CancelDrop", false); - this.autoExpire = compound.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API -+ this.mergeData.count = compound.getIntOr("merge_count", 1); // Sakura - merge cannon entities; load from nbt +@@ -361,6 +418,7 @@ public class FallingBlockEntity extends Entity { + this.blockData = input.read("TileEntityData", CompoundTag.CODEC).map(blockData -> this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock ? null : blockData).map(CompoundTag::copy).orElse(null); // Paper - Filter bad block entity nbt data from falling blocks + this.cancelDrop = input.getBooleanOr("CancelDrop", false); + this.autoExpire = input.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API ++ this.mergeData.count = input.getIntOr("merge_count", 1); // Sakura - merge cannon entities; load from nbt } public void setHurtsEntities(float fallDamagePerDistance, int fallDamageMax) { diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index 0fbac85dd7b624899db3825149a5d2b167ecedaa..a1cbeb8216edda93ac6043b113314d53e9347fd6 100644 +index 2e7f6e3941b34323768e43870541c8e4156c9a8f..0c8343075f5523aa200b58f2afd313d718408ac8 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -35,7 +35,7 @@ import org.bukkit.event.entity.EntityRemoveEvent; +@@ -34,7 +34,7 @@ import org.bukkit.event.entity.EntityRemoveEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit end @@ -198,7 +202,7 @@ index 0fbac85dd7b624899db3825149a5d2b167ecedaa..a1cbeb8216edda93ac6043b113314d53 private static final EntityDataAccessor DATA_FUSE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_BLOCK_STATE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.BLOCK_STATE); private static final short DEFAULT_FUSE_TIME = 80; -@@ -61,11 +61,48 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -60,11 +60,48 @@ public class PrimedTnt extends Entity implements TraceableEntity { public float explosionPower = 4.0F; public boolean isIncendiary = false; // CraftBukkit @@ -247,7 +251,7 @@ index 0fbac85dd7b624899db3825149a5d2b167ecedaa..a1cbeb8216edda93ac6043b113314d53 } public PrimedTnt(Level level, double x, double y, double z, @Nullable LivingEntity owner) { -@@ -145,6 +182,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -144,6 +181,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { if (i <= 0) { // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event //this.discard(); @@ -255,24 +259,28 @@ index 0fbac85dd7b624899db3825149a5d2b167ecedaa..a1cbeb8216edda93ac6043b113314d53 if (!this.level().isClientSide) { this.explode(); } -@@ -218,6 +256,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { - if (this.explosionPower != 4.0F) { - compound.putFloat("explosion_power", this.explosionPower); +@@ -203,6 +241,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { } -+ compound.putInt("merge_count", this.mergeData.count); // Sakura - merge cannon entities; save to nbt + + EntityReference.store(this.owner, output, "owner"); ++ // Sakura start - merge cannon entities; save to nbt ++ if (this.mergeData.count != 1) { ++ output.putInt("merge_count", this.mergeData.count); ++ } ++ // Sakura end - merge cannon entities; save to nbt } @Override -@@ -226,6 +265,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { - this.setFuse(compound.getShortOr("fuse", (short)80)); - this.setBlockState(compound.read("block_state", BlockState.CODEC, registryOps).orElse(DEFAULT_BLOCK_STATE)); - this.explosionPower = Mth.clamp(compound.getFloatOr("explosion_power", 4.0F), 0.0F, 128.0F); -+ this.mergeData.count = compound.getIntOr("merge_count", 1); // Sakura - merge cannon entities; load from nbt +@@ -211,6 +254,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { + this.setBlockState(input.read("block_state", BlockState.CODEC).orElse(DEFAULT_BLOCK_STATE)); + this.explosionPower = Mth.clamp(input.getFloatOr("explosion_power", 4.0F), 0.0F, 128.0F); + this.owner = EntityReference.read(input, "owner"); ++ this.mergeData.count = input.getIntOr("merge_count", 1); // Sakura - merge cannon entities; load from nbt } @Nullable diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 7bf2b9a5a6c0a5c78e8623e158367552eb253fbc..b5e9a92ddb789344650a0c5c10ffec6db5f90035 100644 +index 2fa0725a2b41517e1589e540999118f5c355e899..19788e29f796efd7b1fe79c398c5532eb99add58 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -828,6 +828,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl diff --git a/sakura-server/minecraft-patches/features/0009-Replace-explosion-density-cache.patch b/sakura-server/minecraft-patches/features/0009-Replace-explosion-density-cache.patch index 82ca236..04442bc 100644 --- a/sakura-server/minecraft-patches/features/0009-Replace-explosion-density-cache.patch +++ b/sakura-server/minecraft-patches/features/0009-Replace-explosion-density-cache.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Replace explosion density cache diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index a4428a3c23db6f795b5ff0ead634e2e21468e3a6..ae0b6d506f0344249bdc238fff0f5a3306d05334 100644 +index 5ddfbddbef13b58bf509e4c60bbd72cde2a7f59d..39cf9a8af79ce4c3f1d47eaf7cf3205199b35eb6 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -688,6 +688,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -692,6 +692,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings this.levelTickScheduler.registerNewTask(this.mergeHandler::expire, 200); // Sakura - merge cannon entities @@ -17,7 +17,7 @@ index a4428a3c23db6f795b5ff0ead634e2e21468e3a6..ae0b6d506f0344249bdc238fff0f5a33 // Paper start diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 37271a9e9d3d16a01c437629806508accefa1b9c..d111bd5546613cefd8b4070788679901b7e5b8f4 100644 +index 19788e29f796efd7b1fe79c398c5532eb99add58..c24f09cf9959310353bd0fc5a5ff7498c6ea47a0 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -829,6 +829,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @@ -29,7 +29,7 @@ index 37271a9e9d3d16a01c437629806508accefa1b9c..d111bd5546613cefd8b4070788679901 protected Level( WritableLevelData levelData, diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 71d79a1204d9335c98a63ecda9782755a964b22f..cc337b1656b5bf86da9125a3a1c2da06cc2814ba 100644 +index 1e9b92454edae054c6c3c50dc844c8fc3689f6f8..37721d49fbb5c8914866be4a2bde29a64e3f172e 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -294,7 +294,12 @@ public class ServerExplosion implements Explosion { @@ -46,7 +46,7 @@ index 71d79a1204d9335c98a63ecda9782755a964b22f..cc337b1656b5bf86da9125a3a1c2da06 ++missedRays; } } -@@ -382,8 +387,16 @@ public class ServerExplosion implements Explosion { +@@ -385,8 +390,16 @@ public class ServerExplosion implements Explosion { double d9 = Mth.lerp(d6, boundingBox.minY, boundingBox.maxY); double d10 = Mth.lerp(d7, boundingBox.minZ, boundingBox.maxZ); Vec3 vec3 = new Vec3(d8 + d3, d9, d10 + d4); @@ -65,7 +65,7 @@ index 71d79a1204d9335c98a63ecda9782755a964b22f..cc337b1656b5bf86da9125a3a1c2da06 i++; } -@@ -679,6 +692,11 @@ public class ServerExplosion implements Explosion { +@@ -682,6 +695,11 @@ public class ServerExplosion implements Explosion { return; } // CraftBukkit end @@ -77,7 +77,7 @@ index 71d79a1204d9335c98a63ecda9782755a964b22f..cc337b1656b5bf86da9125a3a1c2da06 for (BlockPos blockPos : blocks) { // CraftBukkit start - TNTPrimeEvent -@@ -851,14 +869,12 @@ public class ServerExplosion implements Explosion { +@@ -848,14 +866,12 @@ public class ServerExplosion implements Explosion { // Paper start - Optimize explosions protected float getBlockDensity(Vec3 vec3d, Entity entity) { @@ -130,7 +130,7 @@ index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..5e2576a8b90de8a829c6136cc384f3fe notifyNeighbors(block, level, blockPosx, opposite); emitState(level, blockPosx, flag2, flag3, flag, flag1); diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java -index c22acc8889fbb3c9ee698624189c195ee4b5eefb..b08ab87278023e50c56a381240712cc2e18a0440 100644 +index 84f3073444ae9e11e5d11224d6af6474ced925e2..281366d8b256a2414e20872c0cb54c9d08501887 100644 --- a/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java @@ -19,6 +19,30 @@ public class AABB { diff --git a/sakura-server/minecraft-patches/features/0010-Optimise-explosions-in-protected-regions.patch b/sakura-server/minecraft-patches/features/0010-Optimise-explosions-in-protected-regions.patch index 886320e..3c36736 100644 --- a/sakura-server/minecraft-patches/features/0010-Optimise-explosions-in-protected-regions.patch +++ b/sakura-server/minecraft-patches/features/0010-Optimise-explosions-in-protected-regions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimise explosions in protected regions diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 38657fa606ae34a3bb752fcd01f7aa732fe17c7e..c597226b6a90ab687d176fe63e21c9c2cd71c7e1 100644 +index 37721d49fbb5c8914866be4a2bde29a64e3f172e..c1e6e27c8424483d5b7e2bce784463e9293b77a0 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -342,6 +342,22 @@ public class ServerExplosion implements Explosion { @@ -31,7 +31,7 @@ index 38657fa606ae34a3bb752fcd01f7aa732fe17c7e..c597226b6a90ab687d176fe63e21c9c2 public ServerExplosion( ServerLevel level, -@@ -446,6 +462,11 @@ public class ServerExplosion implements Explosion { +@@ -449,6 +465,11 @@ public class ServerExplosion implements Explosion { return ret; } // Sakura end - optimise paper explosions diff --git a/sakura-server/minecraft-patches/features/0011-Specialised-Explosions.patch b/sakura-server/minecraft-patches/features/0011-Specialised-Explosions.patch index e14b0cb..2554067 100644 --- a/sakura-server/minecraft-patches/features/0011-Specialised-Explosions.patch +++ b/sakura-server/minecraft-patches/features/0011-Specialised-Explosions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Specialised Explosions diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index fab973cb02218458f23e59665b4f2deb5d54da8d..aa99771955f069d63b90f34e2962f5e5323e8ca8 100644 +index 39cf9a8af79ce4c3f1d47eaf7cf3205199b35eb6..bad69adfbc492d851a3542dc7f77884d9f933c8a 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -1891,7 +1891,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1913,7 +1913,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe case STANDARD -> Explosion.BlockInteraction.DESTROY; // CraftBukkit - handle custom explosion type }; Vec3 vec3 = new Vec3(x, y, z); @@ -26,7 +26,7 @@ index fab973cb02218458f23e59665b4f2deb5d54da8d..aa99771955f069d63b90f34e2962f5e5 if (configurator != null) configurator.accept(serverExplosion);// Paper - Allow explosions to damage source serverExplosion.explode(); // CraftBukkit start -@@ -1899,6 +1908,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1921,6 +1930,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe return serverExplosion; } // CraftBukkit end @@ -42,7 +42,7 @@ index fab973cb02218458f23e59665b4f2deb5d54da8d..aa99771955f069d63b90f34e2962f5e5 ParticleOptions particleOptions = serverExplosion.isSmall() ? smallExplosionParticles : largeExplosionParticles; for (ServerPlayer serverPlayer : this.players) { -@@ -1919,7 +1937,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1941,7 +1959,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } @@ -52,10 +52,10 @@ index fab973cb02218458f23e59665b4f2deb5d54da8d..aa99771955f069d63b90f34e2962f5e5 private Explosion.BlockInteraction getDestroyType(GameRules.Key decayGameRule) { diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index a1cbeb8216edda93ac6043b113314d53e9347fd6..3511e852aebabed8d5f40611db4573f55ca21875 100644 +index 0c8343075f5523aa200b58f2afd313d718408ac8..8986a9876f9437fd8d65f4d43df3f39a98741210 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -80,20 +80,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak +@@ -79,20 +79,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @Override public final void respawnEntity(int count) { @@ -78,7 +78,7 @@ index a1cbeb8216edda93ac6043b113314d53e9347fd6..3511e852aebabed8d5f40611db4573f5 // Sakura end - merge cannon entities diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index c776277ce455b32f99fe06ab409c1923f9dcd325..9f0dcaf0db44925c35fa46fdb2de83540ee959c4 100644 +index c1e6e27c8424483d5b7e2bce784463e9293b77a0..d45582bdfc3fa837c5aa95f499183b60b877b7c2 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -358,6 +358,38 @@ public class ServerExplosion implements Explosion { @@ -120,7 +120,7 @@ index c776277ce455b32f99fe06ab409c1923f9dcd325..9f0dcaf0db44925c35fa46fdb2de8354 public ServerExplosion( ServerLevel level, -@@ -664,7 +696,10 @@ public class ServerExplosion implements Explosion { +@@ -667,7 +699,10 @@ public class ServerExplosion implements Explosion { // CraftBukkit end entity.push(vec3); if (entity instanceof Player player && !player.isSpectator() && (!player.isCreative() || !player.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Option to disable explosion knockback @@ -132,10 +132,10 @@ index c776277ce455b32f99fe06ab409c1923f9dcd325..9f0dcaf0db44925c35fa46fdb2de8354 } entity.onExplosionHit(this.source); -@@ -774,14 +809,7 @@ public class ServerExplosion implements Explosion { - return; - } - // CraftBukkit end +@@ -772,14 +807,7 @@ public class ServerExplosion implements Explosion { + } + + public void explode() { - // Paper start - collision optimisations - this.blockCache = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(); - this.chunkPosCache = new long[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH]; @@ -148,7 +148,7 @@ index c776277ce455b32f99fe06ab409c1923f9dcd325..9f0dcaf0db44925c35fa46fdb2de8354 this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center); List list = this.calculateExplodedPositions(); this.hurtEntities(); -@@ -795,13 +823,7 @@ public class ServerExplosion implements Explosion { +@@ -793,13 +821,7 @@ public class ServerExplosion implements Explosion { if (this.fire) { this.createFire(list); } diff --git a/sakura-server/minecraft-patches/features/0012-Optimise-cannon-entity-movement.patch b/sakura-server/minecraft-patches/features/0012-Optimise-cannon-entity-movement.patch index 2eea133..5d54865 100644 --- a/sakura-server/minecraft-patches/features/0012-Optimise-cannon-entity-movement.patch +++ b/sakura-server/minecraft-patches/features/0012-Optimise-cannon-entity-movement.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimise cannon entity movement diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 68e2b26835a2588a047e9ea175eb8e4912041976..98107921d7251e1b7fc621103a31afdfd3bb5af7 100644 +index 46843fb00310923dc4da31e4554a40696eba57b8..2f80403bb400e88395df9d46a39c4adf69e479d7 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1169,7 +1169,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1191,7 +1191,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess Vec3 vec3 = this.collide(movement); double d = vec3.lengthSqr(); if (d > 1.0E-7 || movement.lengthSqr() - d < 1.0E-7) { @@ -17,7 +17,7 @@ index 68e2b26835a2588a047e9ea175eb8e4912041976..98107921d7251e1b7fc621103a31afdf BlockHitResult blockHitResult = this.level() .clip( new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this) -@@ -1510,6 +1510,131 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1539,6 +1539,131 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return distance; } @@ -150,10 +150,10 @@ index 68e2b26835a2588a047e9ea175eb8e4912041976..98107921d7251e1b7fc621103a31afdf protected Vec3 collide(Vec3 movement) { final boolean xZero = movement.x == 0.0; diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 3af6e04bb4dcd91de2794bbc8d3eff16def9efa8..e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0 100644 +index d65df5f13e038d109870d1f7fba50d2260489d49..0b4cb90a6877c2af4ef1eccd502b50c863bf74b0 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -121,6 +121,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -124,6 +124,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti return itemEntity; } // Sakura end - merge cannon entities @@ -167,10 +167,10 @@ index 3af6e04bb4dcd91de2794bbc8d3eff16def9efa8..e0cee4cda2fb2d55e1da0cedc71cdc0c public FallingBlockEntity(EntityType entityType, Level level) { super(entityType, level); diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index 3511e852aebabed8d5f40611db4573f55ca21875..d523cc4e7089e04d577248d26d7d4e911cd87434 100644 +index 8986a9876f9437fd8d65f4d43df3f39a98741210..9a4b9be72e896ad4def7caa89716c707cfb5cc06 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -83,6 +83,12 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak +@@ -82,6 +82,12 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak this.mergeData.count = count; // Sakura - specialised explosions } // Sakura end - merge cannon entities diff --git a/sakura-server/minecraft-patches/features/0013-Add-maxSearch-to-getEntities.patch b/sakura-server/minecraft-patches/features/0013-Add-maxSearch-to-getEntities.patch index 2ca45bb..43c5651 100644 --- a/sakura-server/minecraft-patches/features/0013-Add-maxSearch-to-getEntities.patch +++ b/sakura-server/minecraft-patches/features/0013-Add-maxSearch-to-getEntities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add maxSearch to getEntities diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java -index 6e3a429bc165d8473ea50ee2ae1548270db599d1..417afe621f559d7fab0798ccf586b630e8878b23 100644 +index bd2055bc89c5672b514f1f7b1ad320a2fba7cbe2..7678696aa2fa74358a374a501a6b7f76f4805945 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java -@@ -314,7 +314,14 @@ public final class ChunkEntitySlices { +@@ -336,7 +336,14 @@ public final class ChunkEntitySlices { public boolean getEntities(final Entity except, final AABB box, final List into, final Predicate predicate, final int maxCount) { @@ -24,7 +24,7 @@ index 6e3a429bc165d8473ea50ee2ae1548270db599d1..417afe621f559d7fab0798ccf586b630 } public void getEntities(final EntityType type, final AABB box, final List into, -@@ -552,6 +559,13 @@ public final class ChunkEntitySlices { +@@ -574,6 +581,13 @@ public final class ChunkEntitySlices { public boolean getEntitiesLimited(final Entity except, final AABB box, final List into, final Predicate predicate, final int maxCount) { @@ -38,7 +38,7 @@ index 6e3a429bc165d8473ea50ee2ae1548270db599d1..417afe621f559d7fab0798ccf586b630 if (this.count == 0) { return false; } -@@ -573,8 +587,14 @@ public final class ChunkEntitySlices { +@@ -595,8 +609,14 @@ public final class ChunkEntitySlices { final Entity[] storage = list.storage; @@ -83,10 +83,10 @@ index 2d24d03bbdb5ee0d862cbfff2219f58afffafe12..1bf06038d51efcc103fad23670686c30 } } diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index d111bd5546613cefd8b4070788679901b7e5b8f4..99571af2e473cb14322625b0287b2f18fcf116d3 100644 +index c24f09cf9959310353bd0fc5a5ff7498c6ea47a0..ca5e2ec53590b731aedf33dfd69e728992f52b91 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -1779,10 +1779,18 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -1772,10 +1772,18 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl this.getEntities(entityTypeTest, bounds, predicate, output, Integer.MAX_VALUE); } @@ -106,7 +106,7 @@ index d111bd5546613cefd8b4070788679901b7e5b8f4..99571af2e473cb14322625b0287b2f18 Profiler.get().incrementCounter("getEntities"); if (entityTypeTest instanceof net.minecraft.world.entity.EntityType byType) { -@@ -1799,7 +1807,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -1792,7 +1800,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl if (entityTypeTest == null) { if (maxCount != Integer.MAX_VALUE) { diff --git a/sakura-server/minecraft-patches/features/0014-Use-maxEntityCollision-limit-for-entity-retrieval.patch b/sakura-server/minecraft-patches/features/0014-Use-maxEntityCollision-limit-for-entity-retrieval.patch index bb12451..f43f0b1 100644 --- a/sakura-server/minecraft-patches/features/0014-Use-maxEntityCollision-limit-for-entity-retrieval.patch +++ b/sakura-server/minecraft-patches/features/0014-Use-maxEntityCollision-limit-for-entity-retrieval.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use maxEntityCollision limit for entity retrieval diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 60b6b19ad5c70991afd5152b45ff20ade457bcd1..70f9a4e4d33dc349404e84faa834613a2d9f2e40 100644 +index 6a28431c6a586adb6cd3e6d38e419fbaf8cafff7..5d4e0efabd61e848db8e0e309cdfd7adaa38b0ce 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -3696,7 +3696,17 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3752,7 +3752,17 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin return; } // Paper end - don't run getEntities if we're not going to use its result diff --git a/sakura-server/minecraft-patches/features/0015-Explosion-Durable-Blocks.patch b/sakura-server/minecraft-patches/features/0015-Explosion-Durable-Blocks.patch index 9c4a811..a040d5b 100644 --- a/sakura-server/minecraft-patches/features/0015-Explosion-Durable-Blocks.patch +++ b/sakura-server/minecraft-patches/features/0015-Explosion-Durable-Blocks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Explosion Durable Blocks diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java -index cc363ba3bc719d8b93992141d779b4c1d1bbd2fb..cdcaf954cec280970f29ac11db906457f18190c6 100644 +index b5b53168755525eccaa0a4361172006522cf4e05..56acdfc2a8d2ecd716065263c59dbcb0ec7135bf 100644 --- a/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java @@ -38,8 +38,31 @@ public class BlockItem extends Item { @@ -41,7 +41,7 @@ index cc363ba3bc719d8b93992141d779b4c1d1bbd2fb..cdcaf954cec280970f29ac11db906457 return !interactionResult.consumesAction() && context.getItemInHand().has(DataComponents.CONSUMABLE) ? super.use(context.getLevel(), context.getPlayer(), context.getHand()) diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index c7a5d369e9889353242d8a70772b2c45684a6951..54d97a271e6a500f5e4ca74bcecbb0f8a1fd1ae2 100644 +index ca5e2ec53590b731aedf33dfd69e728992f52b91..5aaa3f01b7e8b55742ba46dd614f1eaa233aa5c9 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -830,6 +830,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @@ -53,7 +53,7 @@ index c7a5d369e9889353242d8a70772b2c45684a6951..54d97a271e6a500f5e4ca74bcecbb0f8 protected Level( WritableLevelData levelData, diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 9f0dcaf0db44925c35fa46fdb2de83540ee959c4..48d98bac0140cec91fe2c9e7bb72a6f05a70aa49 100644 +index d45582bdfc3fa837c5aa95f499183b60b877b7c2..4a6677fbc520d3f5d537f35a92dab9ec69db47a0 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -131,7 +131,7 @@ public class ServerExplosion implements Explosion { @@ -86,7 +86,7 @@ index 9f0dcaf0db44925c35fa46fdb2de83540ee959c4..48d98bac0140cec91fe2c9e7bb72a6f0 public ServerExplosion( ServerLevel level, -@@ -767,6 +781,14 @@ public class ServerExplosion implements Explosion { +@@ -770,6 +784,14 @@ public class ServerExplosion implements Explosion { } } // CraftBukkit end diff --git a/sakura-server/minecraft-patches/features/0017-Configure-cannon-physics.patch b/sakura-server/minecraft-patches/features/0017-Configure-cannon-physics.patch index 60bb8d5..6ee5cdb 100644 --- a/sakura-server/minecraft-patches/features/0017-Configure-cannon-physics.patch +++ b/sakura-server/minecraft-patches/features/0017-Configure-cannon-physics.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configure cannon physics diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java -index 44aaaa87d63a2a2287f89feaa431ca0e80da3dab..194db5ff2a473b10fded4491c1173d420f46424d 100644 +index 548e3dc8e5fee004483b40a59e2502ba8b93e674..ac78d85e5f9a370eda7c8db8ea02198fb2b50464 100644 --- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java @@ -1774,6 +1774,13 @@ public final class CollisionUtil { @@ -67,10 +67,10 @@ index 44aaaa87d63a2a2287f89feaa431ca0e80da3dab..194db5ff2a473b10fded4491c1173d42 if (xSmaller && z != 0.0) { z = performAABBCollisionsZ(axisalignedbb, z, aabbs); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25d13b6bd9 100644 +index 2f80403bb400e88395df9d46a39c4adf69e479d7..751f8e3045dbb090f16f099097bf31b638df39d7 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -570,6 +570,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -587,6 +587,42 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } // Sakura end - merge cannon entities @@ -80,11 +80,40 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25 + public final me.samsuik.sakura.physics.PhysicsVersion physics() { + return this.physics; + } ++ ++ private static void changeEntityPosition(final Entity entity, final Vec3 position, final Vec3 relativeMovement, ++ final me.samsuik.sakura.physics.PhysicsVersion physics) { ++ final Vec3 newPosition = position.add(relativeMovement); ++ final Vec3 newEntityPosition; ++ if (physics.is(1_21_5)) { ++ newEntityPosition = manglePosition(position, relativeMovement); ++ } else { ++ newEntityPosition = newPosition; ++ } ++ ++ if (physics.afterOrEqual(1_21_5)) { ++ entity.addMovementThisTick(new Entity.Movement(position, newPosition, true)); ++ } ++ ++ entity.setPos(newEntityPosition); ++ } ++ ++ private static Vec3 manglePosition(final Vec3 position, final Vec3 relativeMovement) { ++ Vec3 newPosition = position; ++ for (final Direction.Axis axis : axisStepOrder(relativeMovement)) { ++ final double movement = relativeMovement.get(axis); ++ if (movement != 0.0) { ++ newPosition = newPosition.relative(axis.getPositive(), movement); ++ } ++ } ++ ++ return newPosition; ++ } + // Sakura end - configure cannon physics public Entity(EntityType entityType, Level level) { this.type = entityType; -@@ -1089,7 +1096,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1111,7 +1147,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } protected void checkSupportingBlock(boolean onGround, @Nullable Vec3 movement) { @@ -93,7 +122,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25 AABB boundingBox = this.getBoundingBox(); AABB aabb = new AABB(boundingBox.minX, boundingBox.minY - 1.0E-6, boundingBox.minZ, boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); Optional optional = this.level.findSupportingBlock(this, aabb); -@@ -1139,7 +1146,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1161,7 +1197,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { @@ -105,7 +134,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25 // Paper start - EAR 2 this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); -@@ -1168,8 +1178,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1190,8 +1229,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess movement = this.maybeBackOffFromEdge(movement, type); Vec3 vec3 = this.collide(movement); double d = vec3.lengthSqr(); @@ -118,20 +147,18 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25 BlockHitResult blockHitResult = this.level() .clip( new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this) -@@ -1191,6 +1203,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } +@@ -1202,9 +1243,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } -+ // Sakura start - configure cannon physics -+ if (physics.before(1_21_5)) { -+ list.clear(); -+ vec31 = this.position().add(vec3); -+ } -+ // Sakura end - configure cannon physics - this.movementThisTick.add(list); - this.setPos(vec31); + Vec3 vec31 = this.position(); +- Vec3 vec32 = vec31.add(vec3); +- this.addMovementThisTick(new Entity.Movement(vec31, vec32, true)); +- this.setPos(vec32); ++ changeEntityPosition(this, vec31, vec3, physics); // Sakura - configure cannon physics } -@@ -1223,6 +1241,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + profilerFiller.pop(); +@@ -1235,6 +1274,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { if (this.horizontalCollision) { Vec3 deltaMovement = this.getDeltaMovement(); @@ -144,7 +171,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25 this.setDeltaMovement(flag ? 0.0 : deltaMovement.x, deltaMovement.y, flag1 ? 0.0 : deltaMovement.z); } -@@ -1539,7 +1563,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1568,7 +1613,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess bb = currBoundingBox.expandTowards(movement.x, movement.y, movement.z); } this.collectCollisions(bb, voxelList, bbList, ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER); @@ -153,7 +180,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25 } private Vec3 collideAxisScan(Vec3 movement, AABB currBoundingBox, List voxelList, List bbList) { -@@ -1547,7 +1571,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1576,7 +1621,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess double y = movement.y; double z = movement.z; @@ -165,7 +192,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25 if (y != 0.0) { y = this.scanY(currBoundingBox, y, voxelList, bbList); -@@ -1669,7 +1696,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1698,7 +1746,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), null // Sakura - load chunks on movement ); potentialCollisionsBB.addAll(entityAABBs); @@ -174,28 +201,28 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25 final boolean collidedX = collided.x != movement.x; final boolean collidedY = collided.y != movement.y; -@@ -1795,11 +1822,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - for (Entity.Movement movement : movements) { - Vec3 vec3 = movement.from(); - Vec3 vec31 = movement.to(); -- AABB aabb = this.makeBoundingBox(vec31).deflate(1.0E-5F); -+ // Sakura start - configure cannon physics -+ double margin = this.physics.afterOrEqual(1_21_2) ? 1.0E-5f : this.physics.afterOrEqual(1_19_3) ? 1.0E-7 : 0.001; -+ AABB aabb = this.makeBoundingBox(vec31).deflate(margin); -+ // Sakura end - configure cannon physics - BlockGetter.forEachBlockIntersectedBetween( - vec3, - vec31, - aabb, -+ this.physics, // Sakura - configure cannon physics - (pos, step) -> { - if (this.isAlive()) { - BlockState blockState = this.level().getBlockState(pos); +@@ -1843,11 +1891,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + private void checkInsideBlocks(Vec3 vec3, Vec3 vec31, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector, LongSet set) { +- AABB aabb = this.makeBoundingBox(vec31).deflate(1.0E-5F); ++ // Sakura start - configure cannon physics ++ double margin = this.physics.afterOrEqual(1_21_2) ? 1.0E-5f : this.physics.afterOrEqual(1_19_3) ? 1.0E-7 : 0.001; ++ AABB aabb = this.makeBoundingBox(vec31).deflate(margin); ++ // Sakura end - configure cannon physics + BlockGetter.forEachBlockIntersectedBetween( + vec3, + vec31, + aabb, ++ this.physics, // Sakura - configure cannon physics + (pos, index) -> { + if (!this.isAlive()) { + return false; diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17318fad6b 100644 +index 0b4cb90a6877c2af4ef1eccd502b50c863bf74b0..fb3f28ee3b018462f2274e997d540029560df8d0 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -127,6 +127,43 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -130,6 +130,43 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti return this.sakura_collide(movement); } // Sakura end - optimise cannon entity movement @@ -239,7 +266,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17 public FallingBlockEntity(EntityType entityType, Level level) { super(entityType, level); -@@ -147,6 +184,10 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -150,6 +187,10 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti this.yo = y; this.zo = z; this.setStartPos(this.blockPosition()); @@ -250,7 +277,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17 } // Sakura start - falling block height parity api -@@ -179,7 +220,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -182,7 +223,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState ); if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(fallingBlockEntity, pos, blockState.getFluidState().createLegacyBlock())) return fallingBlockEntity; // CraftBukkit @@ -263,7 +290,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17 level.addFreshEntity(fallingBlockEntity); return fallingBlockEntity; } -@@ -223,7 +268,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -226,7 +271,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @Override protected double getDefaultGravity() { @@ -272,7 +299,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17 } @Override -@@ -232,6 +277,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -235,6 +280,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } else { Block block = this.blockState.getBlock(); @@ -285,7 +312,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17 this.time++; this.applyGravity(); this.move(MoverType.SELF, this.getDeltaMovement()); -@@ -246,8 +297,15 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -249,8 +300,15 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti } // Paper end - Configurable falling blocks height nerf this.handlePortal(); @@ -302,7 +329,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17 boolean flag = this.level().sakuraConfig().cannons.sand.concreteSolidifyInWater && this.blockState.getBlock() instanceof ConcretePowderBlock; // Sakura - configure concrete solidifying in water boolean flag1 = flag && this.level().getFluidState(blockPos).is(FluidTags.WATER); double d = this.getDeltaMovement().lengthSqr(); -@@ -274,8 +332,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -277,8 +335,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti } } else { BlockState blockState = this.level().getBlockState(blockPos); @@ -316,7 +343,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17 if (!this.cancelDrop) { boolean canBeReplaced = blockState.canBeReplaced( new DirectionalPlaceContext(this.level(), blockPos, Direction.DOWN, ItemStack.EMPTY, Direction.UP) -@@ -344,7 +405,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -351,7 +412,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti } } @@ -331,10 +358,10 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17 } diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b583675dab608 100644 +index 9a4b9be72e896ad4def7caa89716c707cfb5cc06..9d563a447d00b3ef53de48582d55abe4eb954182 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -89,6 +89,22 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak +@@ -88,6 +88,22 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak return this.sakura_collide(movement); } // Sakura end - optimise cannon entity movement @@ -357,7 +384,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836 public PrimedTnt(EntityType entityType, Level level) { super(entityType, level); -@@ -114,6 +130,13 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak +@@ -113,6 +129,13 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak case Y -> this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0)); } // Sakura end - configure cannon mechanics @@ -371,7 +398,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836 } // Sakura start - optimise tnt fluid state -@@ -149,7 +172,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak +@@ -148,7 +171,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @Override protected double getDefaultGravity() { @@ -380,7 +407,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836 } @Override -@@ -165,14 +188,19 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak +@@ -164,14 +187,19 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak return; } // Paper end - Configurable TNT height nerf @@ -403,7 +430,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836 // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event //this.discard(); this.tryToRespawnEntity(); // Sakura - merge cannon entities -@@ -226,13 +254,14 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak +@@ -210,13 +238,14 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak return; } // CraftBukkit end @@ -419,7 +446,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836 this.getZ(), event.getRadius(), // CraftBukkit event.getFire(), // CraftBukkit -@@ -318,7 +347,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak +@@ -307,7 +336,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak // Paper start - Option to prevent TNT from moving in water @Override public boolean isPushedByFluid() { @@ -429,27 +456,27 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836 // Paper end - Option to prevent TNT from moving in water } diff --git a/net/minecraft/world/level/BlockGetter.java b/net/minecraft/world/level/BlockGetter.java -index dd7e32b8b176c0f4c13e50aeed33c2c9ccba4b53..673e07e24c0cc0bc8301a15ca028c0bd72a3439c 100644 +index 2146efa860d8323a88f3ad365c0cdb66de42154a..67c9393133f4509abf1bd352fbbc8e21dbb116e2 100644 --- a/net/minecraft/world/level/BlockGetter.java +++ b/net/minecraft/world/level/BlockGetter.java @@ -213,8 +213,14 @@ public interface BlockGetter extends LevelHeightAccessor { } - static void forEachBlockIntersectedBetween(Vec3 from, Vec3 to, AABB boundingBox, BlockGetter.BlockStepVisitor stepVisitor) { + static boolean forEachBlockIntersectedBetween(Vec3 from, Vec3 to, AABB boundingBox, BlockGetter.BlockStepVisitor visitor) { + // Sakura start - configure cannon physics -+ forEachBlockIntersectedBetween(from, to, boundingBox, null, stepVisitor); ++ return forEachBlockIntersectedBetween(from, to, boundingBox, null, visitor); + } + -+ static void forEachBlockIntersectedBetween(Vec3 from, Vec3 to, AABB boundingBox, me.samsuik.sakura.physics.PhysicsVersion physics, BlockGetter.BlockStepVisitor stepVisitor) { ++ static boolean forEachBlockIntersectedBetween(Vec3 from, Vec3 to, AABB boundingBox, me.samsuik.sakura.physics.PhysicsVersion physics, BlockGetter.BlockStepVisitor visitor) { Vec3 vec3 = to.subtract(from); -- if (!(vec3.lengthSqr() < Mth.square(0.99999F))) { -+ if ((physics == null || physics.afterOrEqual(1_21_2)) && !(vec3.lengthSqr() < Mth.square(0.99999F))) { +- if (vec3.lengthSqr() < Mth.square(0.99999F)) { ++ if (physics != null && physics.before(1_21_2) || vec3.lengthSqr() < Mth.square(0.99999F)) { + // Sakura end - configure cannon physics - LongSet set = new LongOpenHashSet(); - Vec3 minPosition = boundingBox.getMinPosition(); - Vec3 vec31 = minPosition.subtract(vec3); + for (BlockPos blockPos : BlockPos.betweenClosed(boundingBox)) { + if (!visitor.visit(blockPos, 0)) { + return false; diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb3770451807 100644 +index ad27005c70cfb48eba05a2cdc42d45d626774999..82ed7843e415595df83c3fb74876ed81d6e63db4 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -409,6 +409,7 @@ public class ServerExplosion implements Explosion { @@ -460,15 +487,15 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37 public ServerExplosion( ServerLevel level, -@@ -430,6 +431,7 @@ public class ServerExplosion implements Explosion { - this.damageCalculator = damageCalculator == null ? this.makeDamageCalculator(source) : damageCalculator; - this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit +@@ -433,6 +434,7 @@ public class ServerExplosion implements Explosion { + this.yield = Double.isFinite(this.yield) ? this.yield : 0; // Paper - Don't allow infinite default yields + // Paper end - add yield this.consistentRadius = level.localConfig().config(BlockPos.containing(this.center)).consistentRadius; // Sakura - consistent explosion radius + this.physics = source != null ? source.physics() : level.localConfig().config(BlockPos.containing(this.center)).physicsVersion; // Sakura - configure cannon physics } private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) { -@@ -459,8 +461,13 @@ public class ServerExplosion implements Explosion { +@@ -462,8 +464,13 @@ public class ServerExplosion implements Explosion { final float density = entity.level().densityCache.getKnownDensity(vec3); if (density != me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) { hitResult = density != 0.0f ? net.minecraft.world.phys.HitResult.Type.MISS : net.minecraft.world.phys.HitResult.Type.BLOCK; @@ -483,7 +510,7 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37 } if (hitResult == HitResult.Type.MISS) { // Sakura end - replace density cache -@@ -558,6 +565,15 @@ public class ServerExplosion implements Explosion { +@@ -561,6 +568,15 @@ public class ServerExplosion implements Explosion { } if (cachedBlock.outOfWorld) { @@ -499,7 +526,7 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37 break; } final BlockState iblockdata = cachedBlock.blockState; -@@ -653,6 +669,12 @@ public class ServerExplosion implements Explosion { +@@ -656,6 +672,12 @@ public class ServerExplosion implements Explosion { double d2 = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.center.y; double d3 = entity.getZ() - this.center.z; double squareRoot = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3); @@ -512,7 +539,7 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37 if (squareRoot != 0.0) { d1 /= squareRoot; d2 /= squareRoot; -@@ -942,7 +964,7 @@ public class ServerExplosion implements Explosion { +@@ -939,7 +961,7 @@ public class ServerExplosion implements Explosion { // Sakura start - replace density cache float blockDensity = this.level.densityCache.getDensity(vec3d, entity); if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) { @@ -521,7 +548,7 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37 this.level.densityCache.putDensity(vec3d, entity, blockDensity); // Sakura end - replace density cache } -@@ -950,6 +972,16 @@ public class ServerExplosion implements Explosion { +@@ -947,6 +969,16 @@ public class ServerExplosion implements Explosion { return blockDensity; } @@ -802,10 +829,10 @@ index 6c789e56f21f01252c21786cfeb48d88485b5636..17ecdee7bd6a8369394115d6534c9d7e } diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d5c5e12a1 100644 +index e87b685d4a2bc31a1d7a1a31881152abc37563ba..2d812099459b808bc0205e4108ef856a3dba6bbe 100644 --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -65,6 +65,150 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -64,6 +64,150 @@ public class PistonMovingBlockEntity extends BlockEntity { this.isSourcePiston = isSourcePiston; } @@ -956,7 +983,7 @@ index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d @Override public CompoundTag getUpdateTag(HolderLookup.Provider registries) { return this.saveCustomOnly(registries); -@@ -169,6 +313,12 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -168,6 +312,12 @@ public class PistonMovingBlockEntity extends BlockEntity { double d4 = 0.0; @@ -969,7 +996,7 @@ index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d for (AABB aabb1 : list) { AABB movementArea = PistonMath.getMovementArea(moveByPositionAndProgress(pos, aabb1, piston), movementDirection, d); AABB boundingBox = entity.getBoundingBox(); -@@ -196,6 +346,11 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -195,6 +345,11 @@ public class PistonMovingBlockEntity extends BlockEntity { NOCLIP.set(noClipDirection); Vec3 vec3 = entity.position(); entity.move(MoverType.PISTON, new Vec3(progress * direction.getStepX(), progress * direction.getStepY(), progress * direction.getStepZ())); @@ -979,9 +1006,9 @@ index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d + } + // Sakura end - configure cannon physics entity.applyEffectsFromBlocks(vec3, entity.position()); - entity.removeLatestMovementRecordingBatch(); + entity.removeLatestMovementRecording(); NOCLIP.set(null); -@@ -308,12 +463,21 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -307,12 +462,21 @@ public class PistonMovingBlockEntity extends BlockEntity { } public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) { @@ -1003,7 +1030,7 @@ index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d level.removeBlockEntity(pos); blockEntity.setRemoved(); if (level.getBlockState(pos).is(Blocks.MOVING_PISTON)) { -@@ -335,12 +499,22 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -334,12 +498,22 @@ public class PistonMovingBlockEntity extends BlockEntity { } } else { float f = blockEntity.progress + 0.5F; diff --git a/sakura-server/minecraft-patches/features/0019-Collide-with-non-solid-blocks.patch b/sakura-server/minecraft-patches/features/0019-Collide-with-non-solid-blocks.patch index e60a98c..a8ebfa1 100644 --- a/sakura-server/minecraft-patches/features/0019-Collide-with-non-solid-blocks.patch +++ b/sakura-server/minecraft-patches/features/0019-Collide-with-non-solid-blocks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Collide with non-solid blocks diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java -index 194db5ff2a473b10fded4491c1173d420f46424d..c09658eb8c2824ac0c887f94771d9b467ecab8b1 100644 +index ac78d85e5f9a370eda7c8db8ea02198fb2b50464..0de9f3d0fb5abbb86bcb9bd2546cea198d105d88 100644 --- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java @@ -1908,6 +1908,7 @@ public final class CollisionUtil { @@ -46,10 +46,10 @@ index 194db5ff2a473b10fded4491c1173d420f46424d..c09658eb8c2824ac0c887f94771d9b46 blockCollision = blockData.getCollisionShape(world, mutablePos, collisionShape); } diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 162062200a4ffa7bc669093779377f0d8d83172e..d61ac5aae3deb9bd145787351fb85051d4ff1aed 100644 +index 751f8e3045dbb090f16f099097bf31b638df39d7..f8efa8d7ea4e79a4baac820f0042c2da7259a849 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -531,6 +531,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -548,6 +548,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess flags |= ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_ADD_TICKET; } diff --git a/sakura-server/minecraft-patches/features/0022-Add-entity-travel-distance-limits.patch b/sakura-server/minecraft-patches/features/0022-Add-entity-travel-distance-limits.patch index 7f41afa..4324bb2 100644 --- a/sakura-server/minecraft-patches/features/0022-Add-entity-travel-distance-limits.patch +++ b/sakura-server/minecraft-patches/features/0022-Add-entity-travel-distance-limits.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add entity travel distance limits diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index b9806bdd4d49ed3fd8c17125143703b6a792b10e..4b3ee01e9dac634941b6cfb0cab43ba1b9069fc9 100644 +index bad69adfbc492d851a3542dc7f77884d9f933c8a..9250806b12171ae4f14d8dbc9dd3d9478bc7b724 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -1295,6 +1295,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1303,6 +1303,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2 if (isActive) { // Paper - EAR 2 entity.tick(); @@ -21,11 +21,11 @@ index b9806bdd4d49ed3fd8c17125143703b6a792b10e..4b3ee01e9dac634941b6cfb0cab43ba1 } else {entity.inactiveTick();} // Paper - EAR 2 profilerFiller.pop(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index d61ac5aae3deb9bd145787351fb85051d4ff1aed..ffe5ad8f3936386fd1fa2b961837fbea5c230407 100644 +index f8efa8d7ea4e79a4baac820f0042c2da7259a849..13b7652cd95b4411927d1e041b246d063fa80fae 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -585,6 +585,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - return this.physics; +@@ -631,6 +631,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + return newPosition; } // Sakura end - configure cannon physics + // Sakura start - entity travel distance limits @@ -44,7 +44,7 @@ index d61ac5aae3deb9bd145787351fb85051d4ff1aed..ffe5ad8f3936386fd1fa2b961837fbea public Entity(EntityType entityType, Level level) { this.type = entityType; -@@ -614,6 +627,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -660,6 +673,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.setPos(0.0, 0.0, 0.0); this.eyeHeight = this.dimensions.eyeHeight(); this.despawnTime = level == null || type == EntityType.PLAYER ? -1 : level.paperConfig().entities.spawning.despawnTime.getOrDefault(type, io.papermc.paper.configuration.type.number.IntOr.Disabled.DISABLED).or(-1); // Paper - entity despawn time limit diff --git a/sakura-server/minecraft-patches/features/0024-Configurable-left-shooting-and-adjusting-limits.patch b/sakura-server/minecraft-patches/features/0024-Configurable-left-shooting-and-adjusting-limits.patch index 5cb8d66..932a0a9 100644 --- a/sakura-server/minecraft-patches/features/0024-Configurable-left-shooting-and-adjusting-limits.patch +++ b/sakura-server/minecraft-patches/features/0024-Configurable-left-shooting-and-adjusting-limits.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable left shooting and adjusting limits diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 8548a41641534fabf44658f014d86df6d27046a0..6cd8e8bae0c62799fde7533f994eb71bf133fe35 100644 +index 13b7652cd95b4411927d1e041b246d063fa80fae..ee7da44161fee45ce3de26d7e990eab3a3f5ff6e 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -598,6 +598,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -644,6 +644,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return Math.max(x, z) >= this.travelDistanceLimit; } // Sakura end - entity travel distance limits @@ -55,7 +55,7 @@ index 8548a41641534fabf44658f014d86df6d27046a0..6cd8e8bae0c62799fde7533f994eb71b public Entity(EntityType entityType, Level level) { this.type = entityType; -@@ -1606,6 +1646,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1656,6 +1696,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } if (xSmaller && z != 0.0) { @@ -63,7 +63,7 @@ index 8548a41641534fabf44658f014d86df6d27046a0..6cd8e8bae0c62799fde7533f994eb71b z = this.scanZ(currBoundingBox, z, voxelList, bbList); if (z != 0.0) { currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetZ(currBoundingBox, z); -@@ -1613,6 +1654,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1663,6 +1704,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } if (x != 0.0) { @@ -76,10 +76,10 @@ index 8548a41641534fabf44658f014d86df6d27046a0..6cd8e8bae0c62799fde7533f994eb71b if (x != 0.0) { currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetX(currBoundingBox, x); diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 3b83c101fd5583f45fdd6fa20e92bc17318fad6b..60e1c2acb267eb277ba06903002a8d687fb309d0 100644 +index fb3f28ee3b018462f2274e997d540029560df8d0..5a6e3769e3d9349927db1986256b3947ef30962e 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -285,6 +285,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti +@@ -288,6 +288,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti // Sakura end - configure cannon physics this.time++; this.applyGravity(); diff --git a/sakura-server/minecraft-patches/features/0025-Optimise-hopper-ticking.patch b/sakura-server/minecraft-patches/features/0025-Optimise-hopper-ticking.patch index ff9d0fe..228ae87 100644 --- a/sakura-server/minecraft-patches/features/0025-Optimise-hopper-ticking.patch +++ b/sakura-server/minecraft-patches/features/0025-Optimise-hopper-ticking.patch @@ -42,7 +42,7 @@ index b382665cc125b8b5c0938e5e55984e4bf91d37ff..0c4358053076416fc2cd3f5c9b7f6d2f boolean isEmpty(); diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 769887ee6d798d0b11de72e9ffe80c9d358daf17..701a48ba3b0f4515a791684d63b3454dbed317f9 100644 +index 5aaa3f01b7e8b55742ba46dd614f1eaa233aa5c9..81378160d021a76d6fddca9c23a1a4691f48e71e 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -1483,7 +1483,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @@ -72,10 +72,10 @@ index 46a27f60ba407dacdac190b5e292ab3f1db5a078..ec05bb86803d878867b46e437cc73a39 } } diff --git a/net/minecraft/world/level/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java -index a1075c26d55cc01219acd94d0138f81aa9d34c48..6aa0624eb99223dc13478a24f74a49654019fba5 100644 +index 5986825d6a381eeb445dd424dd127864aa703163..f77a8c45602d9b30c357557e80a6a97abea99eb2 100644 --- a/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -48,6 +48,60 @@ public abstract class BlockEntity { +@@ -50,6 +50,60 @@ public abstract class BlockEntity { private BlockState blockState; private DataComponentMap components = DataComponentMap.EMPTY; @@ -136,7 +136,7 @@ index a1075c26d55cc01219acd94d0138f81aa9d34c48..6aa0624eb99223dc13478a24f74a4965 public BlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { this.type = type; this.worldPosition = pos.immutable(); -@@ -204,11 +258,22 @@ public abstract class BlockEntity { +@@ -229,11 +283,22 @@ public abstract class BlockEntity { public void setChanged() { if (this.level != null) { if (ignoreBlockEntityUpdates) return; // Paper - Perf: Optimize Hoppers @@ -160,7 +160,7 @@ index a1075c26d55cc01219acd94d0138f81aa9d34c48..6aa0624eb99223dc13478a24f74a4965 level.blockEntityChanged(pos); if (!state.isAir()) { level.updateNeighbourForOutputSignal(pos, state.getBlock()); -@@ -238,6 +303,7 @@ public abstract class BlockEntity { +@@ -263,6 +328,7 @@ public abstract class BlockEntity { public void setRemoved() { this.remove = true; @@ -169,11 +169,11 @@ index a1075c26d55cc01219acd94d0138f81aa9d34c48..6aa0624eb99223dc13478a24f74a4965 public void clearRemoved() { diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 15d4f60942c0cc612c1468b4c0fda886867a67cb..98856a692b3ae5ac46cb67678642709b4f931ee7 100644 +index 800b7e78ae989868ed0b9e060c80dcd002759412..b40c1d20d5823fe63ec34e38a315c7f1bbb5831b 100644 --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -28,7 +28,7 @@ import net.minecraft.world.level.block.HopperBlock; - import net.minecraft.world.level.block.state.BlockState; +@@ -28,7 +28,7 @@ import net.minecraft.world.level.storage.ValueInput; + import net.minecraft.world.level.storage.ValueOutput; import net.minecraft.world.phys.AABB; -public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper { @@ -287,10 +287,10 @@ index 28e3b73507b988f7234cbf29c4024c88180d0aef..a0d247aa883553708c4b921582324255 + // Sakura end - optimise hopper ticking } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index cfc125d43cf3702d46c221f4e7b0d66a15c5d690..9f1a944b82051ea957a0fe725ca95b8f26491f1d 100644 +index a2185062fbb123549be21e37e84541d61ec301c9..d961788584520f5231d65cc63753da4320a48867 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -980,6 +980,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -987,6 +987,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p return BlockEntityType.getKey(this.blockEntity.getType()).toString(); } @@ -304,7 +304,7 @@ index cfc125d43cf3702d46c221f4e7b0d66a15c5d690..9f1a944b82051ea957a0fe725ca95b8f @Override public String toString() { return "Level ticker for " + this.getType() + "@" + this.getPos(); -@@ -1028,6 +1035,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -1035,6 +1042,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p return this.ticker.getType(); } diff --git a/sakura-server/minecraft-patches/features/0026-Optimise-check-inside-blocks-and-traverse-blocks.patch b/sakura-server/minecraft-patches/features/0026-Optimise-check-inside-blocks-and-traverse-blocks.patch new file mode 100644 index 0000000..9201c2f --- /dev/null +++ b/sakura-server/minecraft-patches/features/0026-Optimise-check-inside-blocks-and-traverse-blocks.patch @@ -0,0 +1,110 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samsuik +Date: Fri, 8 Nov 2024 19:35:49 +0000 +Subject: [PATCH] Optimise check inside blocks and traverse blocks + + +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index ee7da44161fee45ce3de26d7e990eab3a3f5ff6e..b804964e620c49130c89d67e0371f06881b95eca 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -1936,6 +1936,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + private void checkInsideBlocks(List movements, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector) { + if (this.isAffectedByBlocks()) { + LongSet set = this.visitedBlocks; ++ final net.minecraft.world.level.chunk.ChunkAccess[] chunkCache = new net.minecraft.world.level.chunk.ChunkAccess[4]; // Sakura - optimise check inside blocks + + for (Entity.Movement movement : movements) { + Vec3 vec3 = movement.from; +@@ -1945,12 +1946,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + double d = vec31.get(axis); + if (d != 0.0) { + Vec3 vec32 = vec3.relative(axis.getPositive(), d); +- this.checkInsideBlocks(vec3, vec32, stepBasedCollector, set); ++ this.checkInsideBlocks(vec3, vec32, stepBasedCollector, set, chunkCache); // Sakura - optimise check inside blocks + vec3 = vec32; + } + } + } else { +- this.checkInsideBlocks(movement.from(), movement.to(), stepBasedCollector, set); ++ this.checkInsideBlocks(movement.from(), movement.to(), stepBasedCollector, set, chunkCache); // Sakura - optimise check inside blocks + } + } + +@@ -1958,7 +1959,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + } + +- private void checkInsideBlocks(Vec3 vec3, Vec3 vec31, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector, LongSet set) { ++ // Sakura start - optimise check inside blocks ++ private void checkInsideBlocks(Vec3 vec3, Vec3 vec31, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector, ++ LongSet set, net.minecraft.world.level.chunk.ChunkAccess[] chunkCache) { ++ // Sakura end - optimise check inside blocks + // Sakura start - configure cannon physics + double margin = this.physics.afterOrEqual(1_21_2) ? 1.0E-5f : this.physics.afterOrEqual(1_19_3) ? 1.0E-7 : 0.001; + AABB aabb = this.makeBoundingBox(vec31).deflate(margin); +@@ -1972,7 +1976,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + if (!this.isAlive()) { + return false; + } else { +- BlockState blockState = this.level().getBlockState(pos); ++ // Sakura start - optimise check inside blocks ++ final int chunkX = pos.getX() >> 4; ++ final int chunkZ = pos.getZ() >> 4; ++ final int chunkKey = ((chunkX << 2) | chunkZ) & 3; ++ net.minecraft.world.level.chunk.ChunkAccess chunk = chunkCache[chunkKey]; ++ if (chunk == null || chunk.locX != chunkX || chunk.locZ != chunkZ) { ++ chunk = this.level().getChunkIfLoadedImmediately(chunkX, chunkZ); ++ if (chunk == null) { ++ return true; ++ } ++ chunkCache[chunkKey] = chunk; ++ } ++ final BlockState blockState = chunk.getBlockState(pos); ++ // Sakura end - optimise check inside blocks + if (blockState.isAir()) { + this.debugBlockIntersection(pos, false, false); + return true; +diff --git a/net/minecraft/world/level/BlockGetter.java b/net/minecraft/world/level/BlockGetter.java +index 67c9393133f4509abf1bd352fbbc8e21dbb116e2..9e235b8bec7ed8da7c0cb099c47c3b23fbccb9b4 100644 +--- a/net/minecraft/world/level/BlockGetter.java ++++ b/net/minecraft/world/level/BlockGetter.java +@@ -221,7 +221,7 @@ public interface BlockGetter extends LevelHeightAccessor { + Vec3 vec3 = to.subtract(from); + if (physics != null && physics.before(1_21_2) || vec3.lengthSqr() < Mth.square(0.99999F)) { + // Sakura end - configure cannon physics +- for (BlockPos blockPos : BlockPos.betweenClosed(boundingBox)) { ++ for (BlockPos blockPos : me.samsuik.sakura.utils.BlockPosIterator.iterable(boundingBox)) { // Sakura - optimise check inside blocks + if (!visitor.visit(blockPos, 0)) { + return false; + } +@@ -229,6 +229,20 @@ public interface BlockGetter extends LevelHeightAccessor { + + return true; + } else { ++ // Sakura start - optimise check inside blocks ++ final boolean xZero = vec3.x() == 0.0; ++ final boolean yZero = vec3.y() == 0.0; ++ final boolean zZero = vec3.z() == 0.0; ++ if (xZero && yZero || yZero && zZero || xZero && zZero) { ++ int blockIndex = 0; ++ for (final BlockPos blockPos : me.samsuik.sakura.utils.BlockPosIterator.traverseArea(vec3, boundingBox)) { ++ if (!visitor.visit(blockPos, blockIndex++)) { ++ return false; ++ } ++ } ++ return true; ++ } ++ // Sakura end - optimise check inside blocks + LongSet set = new LongOpenHashSet(); + Vec3 minPosition = boundingBox.getMinPosition(); + Vec3 vec31 = minPosition.subtract(vec3); +@@ -236,7 +250,7 @@ public interface BlockGetter extends LevelHeightAccessor { + if (i < 0) { + return false; + } else { +- for (BlockPos blockPos1 : BlockPos.betweenClosed(boundingBox)) { ++ for (BlockPos blockPos1 : me.samsuik.sakura.utils.BlockPosIterator.iterable(boundingBox)) { // Sakura - optimise check inside blocks + if (!set.contains(blockPos1.asLong()) && !visitor.visit(blockPos1, i + 1)) { + return false; + } diff --git a/sakura-server/minecraft-patches/features/0026-Optimise-entity-scheduler-ticking.patch b/sakura-server/minecraft-patches/features/0026-Optimise-entity-scheduler-ticking.patch deleted file mode 100644 index cd9a877..0000000 --- a/sakura-server/minecraft-patches/features/0026-Optimise-entity-scheduler-ticking.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samsuik -Date: Fri, 13 Sep 2024 17:22:51 +0100 -Subject: [PATCH] Optimise entity scheduler ticking - - -diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java -index 26207443b1223119c03db478d7e816d9cdf8e618..1664830a49f37825c39fb6b436011d8149196e3a 100644 ---- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java -+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java -@@ -18,6 +18,22 @@ public final class ServerEntityLookup extends EntityLookup { - - private final ServerLevel serverWorld; - public final ReferenceList trackerEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker -+ // Sakura start - optimise entity scheduler ticking -+ public final ReferenceList scheduledEntities = new ReferenceList<>(); -+ -+ public void entityStartScheduled(final Entity entity) { -+ org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = entity.getBukkitEntityRaw(); -+ if (bukkitEntity != null && bukkitEntity.taskScheduler.hasTask()) { -+ this.scheduledEntities.add(bukkitEntity); -+ } -+ } -+ -+ public void entityEndScheduled(final Entity entity) { -+ if (entity.getBukkitEntityRaw() != null) { -+ this.scheduledEntities.remove(entity.getBukkitEntityRaw()); -+ } -+ } -+ // Sakura end - optimise entity scheduler ticking - - public ServerEntityLookup(final ServerLevel world, final LevelCallback worldCallback) { - super(world, worldCallback); -@@ -89,6 +105,7 @@ public final class ServerEntityLookup extends EntityLookup { - // Moonrise start - entity tracker - this.trackerEntities.add(entity); - // Moonrise end - entity tracker -+ this.entityStartScheduled(entity); // Sakura - optimise entity scheduler ticking - } - - @Override -@@ -96,6 +113,7 @@ public final class ServerEntityLookup extends EntityLookup { - // Moonrise start - entity tracker - this.trackerEntities.remove(entity); - // Moonrise end - entity tracker -+ this.entityEndScheduled(entity); // Sakura - optimise entity scheduler ticking - } - - @Override -diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index b234215e59ac303ef7979031ab1b042ff6692b7a..4898079bb4cceeb1106e1eac08f92417bdb2daf7 100644 ---- a/net/minecraft/server/MinecraftServer.java -+++ b/net/minecraft/server/MinecraftServer.java -@@ -1676,7 +1676,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -- for (final net.minecraft.world.entity.Entity entity : level.getEntities().getAll()) { -+ // Sakura start - optimise entity scheduler ticking -+ final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup entityLookup = (ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup) level.moonrise$getEntityLookup(); -+ final java.util.Iterator entityIterator = entityLookup.scheduledEntities.iterator(); -+ while (entityIterator.hasNext()) { -+ final org.bukkit.craftbukkit.entity.CraftEntity scheduledEntity = entityIterator.next(); -+ final net.minecraft.world.entity.Entity entity = scheduledEntity.getHandle(); -+ if (!scheduledEntity.taskScheduler.hasTask()) { -+ entityIterator.remove(); -+ continue; -+ } -+ // Sakura end - optimise entity scheduler ticking - if (entity.isRemoved()) { - continue; - } diff --git a/sakura-server/minecraft-patches/features/0027-Optimise-check-inside-blocks-and-traverse-blocks.patch b/sakura-server/minecraft-patches/features/0027-Optimise-check-inside-blocks-and-traverse-blocks.patch deleted file mode 100644 index 623a585..0000000 --- a/sakura-server/minecraft-patches/features/0027-Optimise-check-inside-blocks-and-traverse-blocks.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samsuik -Date: Fri, 8 Nov 2024 19:35:49 +0000 -Subject: [PATCH] Optimise check inside blocks and traverse blocks - - -diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 6cd8e8bae0c62799fde7533f994eb71bf133fe35..61fc1dafd5af4c3d5a84f8c82b4350f2c311dc96 100644 ---- a/net/minecraft/world/entity/Entity.java -+++ b/net/minecraft/world/entity/Entity.java -@@ -1886,6 +1886,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - private void checkInsideBlocks(List movements, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector) { - if (this.isAffectedByBlocks()) { - LongSet set = this.visitedBlocks; -+ final net.minecraft.world.level.chunk.ChunkAccess[] chunkCache = new net.minecraft.world.level.chunk.ChunkAccess[4]; // Sakura - optimise check inside blocks - - for (Entity.Movement movement : movements) { - Vec3 vec3 = movement.from(); -@@ -1901,7 +1902,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.physics, // Sakura - configure cannon physics - (pos, step) -> { - if (this.isAlive()) { -- BlockState blockState = this.level().getBlockState(pos); -+ // Sakura start - optimise check inside blocks -+ final int chunkX = pos.getX() >> 4; -+ final int chunkZ = pos.getZ() >> 4; -+ final int chunkKey = ((chunkX << 2) | chunkZ) & 3; -+ net.minecraft.world.level.chunk.ChunkAccess chunk = chunkCache[chunkKey]; -+ if (chunk == null || chunk.locX != chunkX || chunk.locZ != chunkZ) { -+ chunk = this.level().getChunkIfLoadedImmediately(chunkX, chunkZ); -+ if (chunk == null) { -+ return; -+ } -+ chunkCache[chunkKey] = chunk; -+ } -+ final BlockState blockState = chunk.getBlockState(pos); -+ // Sakura end - optimise check inside blocks - if (!blockState.isAir()) { - if (set.add(pos.asLong())) { - VoxelShape entityInsideCollisionShape = blockState.getEntityInsideCollisionShape(this.level(), pos, this); -diff --git a/net/minecraft/world/level/BlockGetter.java b/net/minecraft/world/level/BlockGetter.java -index 673e07e24c0cc0bc8301a15ca028c0bd72a3439c..11f9181e5c829cff7adf4feef9a6e6942b021850 100644 ---- a/net/minecraft/world/level/BlockGetter.java -+++ b/net/minecraft/world/level/BlockGetter.java -@@ -221,18 +221,30 @@ public interface BlockGetter extends LevelHeightAccessor { - Vec3 vec3 = to.subtract(from); - if ((physics == null || physics.afterOrEqual(1_21_2)) && !(vec3.lengthSqr() < Mth.square(0.99999F))) { - // Sakura end - configure cannon physics -+ // Sakura start - optimise check inside blocks -+ final boolean xZero = vec3.x() == 0.0; -+ final boolean yZero = vec3.y() == 0.0; -+ final boolean zZero = vec3.z() == 0.0; -+ if (xZero && yZero || yZero && zZero || xZero && zZero) { -+ int blockIndex = 0; -+ for (BlockPos blockPos : me.samsuik.sakura.utils.BlockPosIterator.traverseArea(vec3, boundingBox)) { -+ stepVisitor.visit(blockPos, blockIndex++); -+ } -+ return; -+ } -+ // Sakura end - optimise check inside blocks - LongSet set = new LongOpenHashSet(); - Vec3 minPosition = boundingBox.getMinPosition(); - Vec3 vec31 = minPosition.subtract(vec3); - int i = addCollisionsAlongTravel(set, vec31, minPosition, boundingBox, stepVisitor); - -- for (BlockPos blockPos1 : BlockPos.betweenClosed(boundingBox)) { -+ for (BlockPos blockPos1 : me.samsuik.sakura.utils.BlockPosIterator.iterable(boundingBox)) { // Sakura - optimise check inside blocks - if (!set.contains(blockPos1.asLong())) { - stepVisitor.visit(blockPos1, i + 1); - } - } - } else { -- for (BlockPos blockPos : BlockPos.betweenClosed(boundingBox)) { -+ for (BlockPos blockPos : me.samsuik.sakura.utils.BlockPosIterator.iterable(boundingBox)) { // Sakura - optimise check inside blocks - stepVisitor.visit(blockPos, 0); - } - } diff --git a/sakura-server/minecraft-patches/features/0028-copy-EntityList-implementation-to-BasicEntityList.patch b/sakura-server/minecraft-patches/features/0027-copy-EntityList-implementation-to-BasicEntityList.patch similarity index 90% rename from sakura-server/minecraft-patches/features/0028-copy-EntityList-implementation-to-BasicEntityList.patch rename to sakura-server/minecraft-patches/features/0027-copy-EntityList-implementation-to-BasicEntityList.patch index eb12355..1f80718 100644 --- a/sakura-server/minecraft-patches/features/0028-copy-EntityList-implementation-to-BasicEntityList.patch +++ b/sakura-server/minecraft-patches/features/0027-copy-EntityList-implementation-to-BasicEntityList.patch @@ -5,10 +5,10 @@ Subject: [PATCH] copy EntityList implementation to BasicEntityList diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java -index 417afe621f559d7fab0798ccf586b630e8878b23..512a3b2d09d90e07158684995477d79dff3821b5 100644 +index 7678696aa2fa74358a374a501a6b7f76f4805945..1fa98cb7f853a29d2eaa297fc4e6e4c20e8d49e4 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java -@@ -396,6 +396,13 @@ public final class ChunkEntitySlices { +@@ -418,6 +418,13 @@ public final class ChunkEntitySlices { private E[] storage; private int size; @@ -22,7 +22,7 @@ index 417afe621f559d7fab0798ccf586b630e8878b23..512a3b2d09d90e07158684995477d79d public BasicEntityList() { this(0); -@@ -416,6 +423,7 @@ public final class ChunkEntitySlices { +@@ -438,6 +445,7 @@ public final class ChunkEntitySlices { private void resize() { if (this.storage == EMPTY) { this.storage = (E[])new Entity[DEFAULT_CAPACITY]; @@ -30,7 +30,7 @@ index 417afe621f559d7fab0798ccf586b630e8878b23..512a3b2d09d90e07158684995477d79d } else { this.storage = Arrays.copyOf(this.storage, this.storage.length * 2); } -@@ -429,6 +437,7 @@ public final class ChunkEntitySlices { +@@ -451,6 +459,7 @@ public final class ChunkEntitySlices { } else { this.storage[idx] = entity; } @@ -38,7 +38,7 @@ index 417afe621f559d7fab0798ccf586b630e8878b23..512a3b2d09d90e07158684995477d79d } public int indexOf(final E entity) { -@@ -444,24 +453,32 @@ public final class ChunkEntitySlices { +@@ -466,24 +475,32 @@ public final class ChunkEntitySlices { } public boolean remove(final E entity) { diff --git a/sakura-server/minecraft-patches/features/0029-Cache-vanilla-and-eigencraft-redstone-wires.patch b/sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch similarity index 97% rename from sakura-server/minecraft-patches/features/0029-Cache-vanilla-and-eigencraft-redstone-wires.patch rename to sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch index 46276c2..41a94a6 100644 --- a/sakura-server/minecraft-patches/features/0029-Cache-vanilla-and-eigencraft-redstone-wires.patch +++ b/sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch @@ -33,10 +33,10 @@ index ff747a1ecdf3c888bca0d69de4f85dcd810b6139..d90f6aa4557b5863eba6a206226f763c } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 8f17606889b767539c19015ae7f1cb7795616b88..529c412890993600d52287e0446757d1598bb45a 100644 +index 9250806b12171ae4f14d8dbc9dd3d9478bc7b724..a3306fcdc83bb5f0157e1d9805a4d134403ce5f9 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -689,6 +689,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -693,6 +693,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings this.levelTickScheduler.registerNewTask(this.mergeHandler::expire, 200); // Sakura - merge cannon entities this.levelTickScheduler.registerNewTask(this.densityCache::invalidate, 0); // Sakura - explosion density cache @@ -45,7 +45,7 @@ index 8f17606889b767539c19015ae7f1cb7795616b88..529c412890993600d52287e0446757d1 // Paper start diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 701a48ba3b0f4515a791684d63b3454dbed317f9..8156e920d76a92fd74b90de816aaff0ced480b5f 100644 +index 81378160d021a76d6fddca9c23a1a4691f48e71e..e894c404d58f95c8f54987739ad24b6a0b96dfc3 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -831,6 +831,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @@ -99,7 +99,7 @@ index 270c405a7384e3290b4eea58e0b231aa6235d85a..a1428aab6923a58c04d206d63babd932 : powerValue; } diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index fed11ed5ab97826915710b66395d1bdc926935b0..d6131c5ec6a4229291f7cecb9cec9251d54244ed 100644 +index 969488021cfc462b85750f25c1c256ab6709ff89..bfc63f858b229d9ccd1827821b66ba55124d2fda 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -521,6 +521,13 @@ public abstract class BlockBehaviour implements FeatureElement { diff --git a/sakura-server/minecraft-patches/features/0030-Configure-breaking-blocks-outside-the-world-border.patch b/sakura-server/minecraft-patches/features/0029-Configure-breaking-blocks-outside-the-world-border.patch similarity index 86% rename from sakura-server/minecraft-patches/features/0030-Configure-breaking-blocks-outside-the-world-border.patch rename to sakura-server/minecraft-patches/features/0029-Configure-breaking-blocks-outside-the-world-border.patch index 443bd08..2cd3fbe 100644 --- a/sakura-server/minecraft-patches/features/0030-Configure-breaking-blocks-outside-the-world-border.patch +++ b/sakura-server/minecraft-patches/features/0029-Configure-breaking-blocks-outside-the-world-border.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configure breaking blocks outside the world border diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 9a3cf92fd767559484d3bd9f94e1c13facbfa86f..05d288c0f467ca28d28afa944c5ec41952085ec9 100644 +index 78b44fc3dda798d54656318b948c55dcb3b03ecb..d86f6f6a43584967b6e256be32c3144fbb2a326f 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -535,6 +535,11 @@ public class ServerExplosion implements Explosion { +@@ -538,6 +538,11 @@ public class ServerExplosion implements Explosion { return ret; } // Sakura end - optimise protected explosions diff --git a/sakura-server/minecraft-patches/features/0031-Optimise-block-counting-for-cannon-entities.patch b/sakura-server/minecraft-patches/features/0030-Optimise-block-counting-for-cannon-entities.patch similarity index 97% rename from sakura-server/minecraft-patches/features/0031-Optimise-block-counting-for-cannon-entities.patch rename to sakura-server/minecraft-patches/features/0030-Optimise-block-counting-for-cannon-entities.patch index cd665e2..46adf87 100644 --- a/sakura-server/minecraft-patches/features/0031-Optimise-block-counting-for-cannon-entities.patch +++ b/sakura-server/minecraft-patches/features/0030-Optimise-block-counting-for-cannon-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimise block counting for cannon entities diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java -index c09658eb8c2824ac0c887f94771d9b467ecab8b1..992354bfc3f279946635d3a8f2bc109d4f1c8603 100644 +index 0de9f3d0fb5abbb86bcb9bd2546cea198d105d88..92b4914577b500e2114e9160f0af8d46d5096672 100644 --- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java @@ -1943,6 +1943,7 @@ public final class CollisionUtil { @@ -42,7 +42,7 @@ index c09658eb8c2824ac0c887f94771d9b467ecab8b1..992354bfc3f279946635d3a8f2bc109d for (int currY = minYIterate; currY <= maxYIterate; ++currY) { final int blockY = currY | (currChunkY << 4); diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 8156e920d76a92fd74b90de816aaff0ced480b5f..32171561b4cd98f1f260bf14e1ac16b0684f325f 100644 +index e894c404d58f95c8f54987739ad24b6a0b96dfc3..e77b59f8415c07ddb65a669423eaad9214abe6ab 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -616,6 +616,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl diff --git a/sakura-server/minecraft-patches/features/0032-Protect-blocks-above-a-configured-Y-level-from-explo.patch b/sakura-server/minecraft-patches/features/0031-Protect-blocks-above-a-configured-Y-level-from-explo.patch similarity index 92% rename from sakura-server/minecraft-patches/features/0032-Protect-blocks-above-a-configured-Y-level-from-explo.patch rename to sakura-server/minecraft-patches/features/0031-Protect-blocks-above-a-configured-Y-level-from-explo.patch index 9655de2..108fb77 100644 --- a/sakura-server/minecraft-patches/features/0032-Protect-blocks-above-a-configured-Y-level-from-explo.patch +++ b/sakura-server/minecraft-patches/features/0031-Protect-blocks-above-a-configured-Y-level-from-explo.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Protect blocks above a configured Y-level from explosions diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 82fdd92a7a8122a9e409db2491a56df0311cad30..1b48793a6472ab015d0f7d7755d77104cccd18c3 100644 +index d86f6f6a43584967b6e256be32c3144fbb2a326f..d0e7347f5d57e77e28fb2145552db67d67e4c25b 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -414,6 +414,11 @@ public class ServerExplosion implements Explosion { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch index 634ab71..02fdc5c 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch +++ b/sakura-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 -@@ -299,6 +_,7 @@ +@@ -300,6 +_,7 @@ public volatile boolean abnormalExit; // Paper - Improved watchdog support public volatile Thread shutdownThread; // Paper - Improved watchdog support public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files @@ -8,7 +8,7 @@ public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked private final Set pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation -@@ -317,6 +_,17 @@ +@@ -319,6 +_,17 @@ thread.start(); return minecraftServer; } @@ -26,7 +26,7 @@ // Paper start - rewrite chunk system private volatile Throwable chunkSystemCrash; -@@ -469,6 +_,10 @@ +@@ -471,6 +_,10 @@ Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); // CraftBukkit end this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files @@ -37,7 +37,7 @@ } private void readScoreboard(DimensionDataStorage dataStorage) { -@@ -1219,6 +_,7 @@ +@@ -1222,6 +_,7 @@ if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) { final long diff = currentTime - tickSection; final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP); @@ -45,7 +45,7 @@ tps1.add(currentTps, diff); tps5.add(currentTps, diff); tps15.add(currentTps, diff); -@@ -1256,6 +_,7 @@ +@@ -1259,6 +_,7 @@ // Paper end - rewrite chunk system this.tickFrame.end(); profilerFiller.popPush("nextTickWait"); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch index 7e404d7..295e625 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch +++ b/sakura-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 -@@ -580,7 +_,7 @@ +@@ -583,7 +_,7 @@ org.bukkit.generator.BiomeProvider biomeProvider // CraftBukkit ) { // CraftBukkit start diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch index 3fd365c..88a4283 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -420,6 +_,7 @@ +@@ -431,6 +_,7 @@ public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent public @Nullable String clientBrandName = null; // Paper - Brand support public @Nullable org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch index 964140b..4e440dd 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -515,6 +_,7 @@ +@@ -532,6 +_,7 @@ } } // Paper end - optimise entity tracker @@ -8,7 +8,7 @@ public Entity(EntityType entityType, Level level) { this.type = entityType; -@@ -4007,7 +_,7 @@ +@@ -4228,7 +_,7 @@ } public boolean isPushedByFluid() { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch index 2a23a45..61d05e8 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -274,6 +_,43 @@ +@@ -287,6 +_,43 @@ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay; // Paper - Make shield blocking delay configurable // CraftBukkit end @@ -44,7 +44,7 @@ protected LivingEntity(EntityType entityType, Level level) { super(entityType, level); -@@ -1481,7 +_,7 @@ +@@ -1513,7 +_,7 @@ } // Paper end - Check distance in entity interactions @@ -53,7 +53,7 @@ if (!flag) { this.indicateDamage(d, d1); } -@@ -1583,6 +_,11 @@ +@@ -1615,6 +_,11 @@ if (itemBlockingWith == null) { return false; } else { @@ -65,7 +65,7 @@ BlocksAttacks blocksAttacks = itemBlockingWith.get(DataComponents.BLOCKS_ATTACKS); if (blocksAttacks != null && !blocksAttacks.bypassedBy().map(damageSource::is).orElse(false)) { if (damageSource.getDirectEntity() instanceof AbstractArrow abstractArrow && abstractArrow.getPierceLevel() > 0) { -@@ -1609,6 +_,12 @@ +@@ -1641,6 +_,12 @@ acos = (float) Math.PI; } @@ -78,7 +78,7 @@ BlocksAttacks blocksAttacks = this.getItemBlockingWith().get(DataComponents.BLOCKS_ATTACKS); return blocksAttacks.resolveBlockedDamage(damageSource, damageAmount, acos); } -@@ -1676,7 +_,7 @@ +@@ -1708,7 +_,7 @@ } protected void blockedByItem(LivingEntity entity) { @@ -87,7 +87,7 @@ } private boolean checkTotemDeathProtection(DamageSource damageSource) { -@@ -1833,6 +_,12 @@ +@@ -1865,6 +_,12 @@ // Paper start if (this.dead) { // Paper @@ -100,7 +100,7 @@ this.level().broadcastEntityEvent(this, (byte)3); this.setPose(Pose.DYING); -@@ -2006,7 +_,7 @@ +@@ -2038,7 +_,7 @@ } public void knockback(double strength, double x, double z, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause eventCause) { // Paper - knockback events @@ -109,7 +109,7 @@ if (true || !(strength <= 0.0)) { // CraftBukkit - Call event even when force is 0 // this.hasImpulse = true; // CraftBukkit - Move down Vec3 deltaMovement = this.getDeltaMovement(); -@@ -2017,10 +_,18 @@ +@@ -2049,10 +_,18 @@ } Vec3 vec3 = new Vec3(x, 0.0, z).normalize().scale(strength); @@ -129,7 +129,7 @@ deltaMovement.z / 2.0 - vec3.z ); Vec3 diff = finalVelocity.subtract(deltaMovement); -@@ -2165,8 +_,14 @@ +@@ -2197,8 +_,14 @@ } } @@ -145,7 +145,7 @@ return 0; } else { double d = this.calculateFallPower(fallDistance); -@@ -2224,9 +_,21 @@ +@@ -2256,9 +_,21 @@ protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damageAmount) { if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) { // this.hurtArmor(damageSource, damageAmount); // CraftBukkit - actuallyHurt(DamageSource, float, EntityDamageEvent) for damage handling @@ -167,7 +167,7 @@ } return damageAmount; -@@ -2406,6 +_,12 @@ +@@ -2438,6 +_,12 @@ armorDamage += (float) event.getDamage(DamageModifier.BLOCKING); armorDamage += (float) event.getDamage(DamageModifier.FREEZING); armorDamage += (float) event.getDamage(DamageModifier.HARD_HAT); @@ -180,7 +180,7 @@ this.hurtArmor(damageSource, armorDamage); } -@@ -3332,6 +_,11 @@ +@@ -3384,6 +_,11 @@ if (this.level() instanceof ServerLevel serverLevel) { EnchantmentHelper.runLocationChangedEffects(serverLevel, itemBySlot, this, equipmentSlot1); } @@ -192,7 +192,7 @@ } } -@@ -3532,7 +_,7 @@ +@@ -3584,7 +_,7 @@ } } // Paper end - Add EntityMoveEvent @@ -201,7 +201,7 @@ this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F); } } -@@ -4107,6 +_,13 @@ +@@ -4163,6 +_,13 @@ if (!this.isUsingItem()) { return null; } else { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch index 2385c5d..977948d 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -716,7 +_,7 @@ +@@ -733,7 +_,7 @@ protected final void serverAiStep() { this.noActionTime++; // Paper start - Allow nerfed mobs to jump and float diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/animal/IronGolem.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/animal/IronGolem.java.patch index 963a68e..0a00582 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/animal/IronGolem.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/animal/IronGolem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/IronGolem.java +++ b/net/minecraft/world/entity/animal/IronGolem.java -@@ -229,6 +_,13 @@ +@@ -230,6 +_,13 @@ } } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch index e456bb0..915b865 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -70,9 +_,12 @@ +@@ -73,9 +_,12 @@ public boolean forceTickAfterTeleportToDuplicate; protected static final EntityDataAccessor DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS); public boolean autoExpire = true; // Paper - Expand FallingBlock API @@ -13,7 +13,7 @@ } public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { -@@ -87,6 +_,27 @@ +@@ -90,6 +_,27 @@ this.setStartPos(this.blockPosition()); } @@ -41,7 +41,7 @@ public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState blockState) { FallingBlockEntity fallingBlockEntity = new FallingBlockEntity( level, -@@ -165,7 +_,7 @@ +@@ -168,7 +_,7 @@ this.handlePortal(); if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { BlockPos blockPos = this.blockPosition(); @@ -50,7 +50,7 @@ boolean flag1 = flag && this.level().getFluidState(blockPos).is(FluidTags.WATER); double d = this.getDeltaMovement().lengthSqr(); if (flag && d > 1.0) { -@@ -181,7 +_,7 @@ +@@ -184,7 +_,7 @@ } } @@ -59,7 +59,7 @@ if ((this.time > 100 && autoExpire) && (blockPos.getY() <= this.level().getMinY() || blockPos.getY() > this.level().getMaxY()) || (this.time > 600 && autoExpire)) { // Paper - Expand FallingBlock API if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { this.spawnAtLocation(serverLevel, block); -@@ -199,7 +_,7 @@ +@@ -202,7 +_,7 @@ ); boolean flag2 = FallingBlock.isFree(this.level().getBlockState(blockPos.below())) && (!flag || !flag1); boolean flag3 = this.blockState.canSurvive(this.level(), blockPos) && !flag2; @@ -68,7 +68,7 @@ if (this.blockState.hasProperty(BlockStateProperties.WATERLOGGED) && this.level().getFluidState(blockPos).getType() == Fluids.WATER) { this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true); -@@ -240,6 +_,10 @@ +@@ -247,6 +_,10 @@ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause this.callOnBrokenAfterFall(block, blockPos); this.spawnAtLocation(serverLevel, block); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch index 39792fa..2ae6d9f 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -370,6 +_,13 @@ +@@ -368,6 +_,13 @@ @Override public boolean ignoreExplosion(Explosion explosion) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch index b3aab8a..22accbe 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -76,7 +_,28 @@ +@@ -75,7 +_,28 @@ this.yo = y; this.zo = z; - this.owner = owner; + this.owner = owner != null ? new EntityReference<>(owner) : null; - } + // Sakura start - configure cannon mechanics + switch (level.sakuraConfig().cannons.mechanics.tntSpread) { @@ -30,7 +30,7 @@ @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { -@@ -101,7 +_,7 @@ +@@ -100,7 +_,7 @@ @Override public void tick() { @@ -39,7 +39,7 @@ this.handlePortal(); this.applyGravity(); this.move(MoverType.SELF, this.getDeltaMovement()); -@@ -133,6 +_,14 @@ +@@ -132,6 +_,14 @@ this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5, this.getZ(), 0.0, 0.0, 0.0); } } @@ -53,8 +53,8 @@ + // Sakura end - configure force position updates // Paper start - Option to prevent TNT from moving in water if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) { - /* -@@ -250,7 +_,7 @@ + this.hurtMarked = true; +@@ -235,7 +_,7 @@ // Paper start - Option to prevent TNT from moving in water @Override public boolean isPushedByFluid() { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch index 46db60e..62e2374 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Creeper.java +++ b/net/minecraft/world/entity/monster/Creeper.java -@@ -246,7 +_,12 @@ +@@ -247,7 +_,12 @@ if (!event.isCancelled()) { // CraftBukkit end this.dead = true; diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch index 0b4514c..11497b1 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch +++ b/sakura-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 -@@ -210,6 +_,7 @@ +@@ -219,6 +_,7 @@ private int currentImpulseContextResetGraceTime = 0; public boolean affectsSpawning = true; // Paper - Affects Spawning API public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage @@ -8,7 +8,7 @@ // CraftBukkit start public boolean fauxSleeping; -@@ -857,6 +_,10 @@ +@@ -866,6 +_,10 @@ public boolean isInvulnerableTo(ServerLevel level, DamageSource damageSource) { if (super.isInvulnerableTo(level, damageSource)) { return true; @@ -19,7 +19,7 @@ } else if (damageSource.is(DamageTypeTags.IS_DROWNING)) { return !level.getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE); } else if (damageSource.is(DamageTypeTags.IS_FALL)) { -@@ -1170,13 +_,19 @@ +@@ -1182,13 +_,19 @@ if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable. { // Paper end - PlayerAttackEntityEvent @@ -40,7 +40,7 @@ // this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt if (target.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE) && target instanceof Projectile projectile) { -@@ -1194,7 +_,7 @@ +@@ -1206,7 +_,7 @@ if (f > 0.0F || f1 > 0.0F) { boolean flag = attackStrengthScale > 0.9F; boolean flag1; @@ -49,7 +49,7 @@ this.sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility flag1 = true; } else { -@@ -1210,7 +_,7 @@ +@@ -1222,7 +_,7 @@ && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity @@ -58,7 +58,7 @@ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits if (flag2) { damageSource = damageSource.critical(); // Paper - critical damage API -@@ -1237,7 +_,21 @@ +@@ -1249,7 +_,21 @@ if (flag4) { float f4 = this.getKnockback(target, damageSource) + (flag1 ? 1.0F : 0.0F); if (f4 > 0.0F) { @@ -81,7 +81,7 @@ livingEntity1.knockback( f4 * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) , this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK // Paper - knockback events -@@ -1259,7 +_,7 @@ +@@ -1271,7 +_,7 @@ // Paper end - Configurable sprint interruption on attack } @@ -90,7 +90,7 @@ float f5 = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * f; for (LivingEntity livingEntity2 : this.level() -@@ -1275,7 +_,7 @@ +@@ -1287,7 +_,7 @@ if (this.level() instanceof ServerLevel serverLevel && livingEntity2.hurtServer(serverLevel, damageSource.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK), f6) && !livingEntity2.lastDamageCancelled) { // Paper end - Only apply knockback if the event is not cancelled livingEntity2.knockback( @@ -99,7 +99,7 @@ , this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK // Paper - knockback events ); EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity2, damageSource); -@@ -1363,7 +_,7 @@ +@@ -1375,7 +_,7 @@ if (target instanceof LivingEntity) { float f7 = f3 - ((LivingEntity)target).getHealth(); this.awardStat(Stats.DAMAGE_DEALT, Math.round(f7 * 10.0F)); @@ -108,7 +108,7 @@ int i = (int)(f7 * 0.5); ((ServerLevel)this.level()) .sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5), target.getZ(), i, 0.1, 0.0, 0.1, 0.2); -@@ -1753,6 +_,7 @@ +@@ -1765,6 +_,7 @@ // Paper start - send while respecting visibility private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { @@ -116,7 +116,7 @@ fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity itself if (fromEntity instanceof ServerPlayer serverPlayer) { serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong())); -@@ -2100,7 +_,13 @@ +@@ -2119,7 +_,13 @@ @Override public EntityDimensions getDefaultDimensions(Pose pose) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch index 1d7c83f..b85dfe9 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java +++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java -@@ -42,6 +_,25 @@ +@@ -39,6 +_,25 @@ super(entityType, x, y, z, level, item); } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch index 0ef4bdb..bd71468 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/FishingHook.java +++ b/net/minecraft/world/entity/projectile/FishingHook.java -@@ -287,6 +_,12 @@ +@@ -298,6 +_,12 @@ if (!this.level().isClientSide) { this.setHookedEntity(result.getEntity()); } @@ -13,7 +13,7 @@ } @Override -@@ -588,7 +_,7 @@ +@@ -599,7 +_,7 @@ public void pullEntity(Entity entity) { Entity owner = this.getOwner(); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch index 4c2aa0d..ea49a4a 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -@@ -182,6 +_,13 @@ +@@ -179,6 +_,13 @@ } } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/food/FoodData.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/food/FoodData.java.patch index 2c37589..aa747b6 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/food/FoodData.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/food/FoodData.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/food/FoodData.java +++ b/net/minecraft/world/food/FoodData.java -@@ -65,7 +_,7 @@ +@@ -66,7 +_,7 @@ } boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/ItemStack.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/ItemStack.java.patch index 08e13d7..906f878 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/ItemStack.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/ItemStack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -846,6 +_,15 @@ +@@ -826,6 +_,15 @@ } } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Items.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Items.java.patch index cd19716..ebc7a2f 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Items.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Items.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java -@@ -1107,32 +_,32 @@ +@@ -1158,32 +_,32 @@ public static final Item GOLD_INGOT = registerItem("gold_ingot", new Item.Properties().trimMaterial(TrimMaterials.GOLD)); public static final Item NETHERITE_INGOT = registerItem("netherite_ingot", new Item.Properties().fireResistant().trimMaterial(TrimMaterials.NETHERITE)); public static final Item NETHERITE_SCRAP = registerItem("netherite_scrap", new Item.Properties().fireResistant()); @@ -39,7 +39,7 @@ public static final Item NETHERITE_SHOVEL = registerItem( "netherite_shovel", properties -> new ShovelItem(ToolMaterial.NETHERITE, 1.5F, -3.0F, properties), new Item.Properties().fireResistant() ); -@@ -1210,6 +_,7 @@ +@@ -1261,6 +_,7 @@ public static final Item GOLDEN_APPLE = registerItem("golden_apple", new Item.Properties().food(Foods.GOLDEN_APPLE, Consumables.GOLDEN_APPLE)); public static final Item ENCHANTED_GOLDEN_APPLE = registerItem( "enchanted_golden_apple", @@ -47,7 +47,7 @@ new Item.Properties() .rarity(Rarity.RARE) .food(Foods.ENCHANTED_GOLDEN_APPLE, Consumables.ENCHANTED_GOLDEN_APPLE) -@@ -1311,12 +_,12 @@ +@@ -1362,12 +_,12 @@ (block, properties) -> new HangingSignItem(block, Blocks.WARPED_WALL_HANGING_SIGN, properties), new Item.Properties().stacksTo(16) ); @@ -63,7 +63,7 @@ ); public static final Item POWDER_SNOW_BUCKET = registerItem( "powder_snow_bucket", -@@ -1327,6 +_,7 @@ +@@ -1378,6 +_,7 @@ public static final Item LEATHER = registerItem("leather"); public static final Item MILK_BUCKET = registerItem( "milk_bucket", diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch index 51dff6e..7db2aac 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java -@@ -48,12 +_,24 @@ +@@ -55,12 +_,24 @@ public int spawnRange = 4; private int tickDelay = 0; // Paper - Configurable mob spawner tick rate @@ -25,52 +25,52 @@ return level.hasNearbyAlivePlayerThatAffectsSpawning(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, this.requiredPlayerRange); // Paper - Affects Spawning API } -@@ -122,7 +_,7 @@ - if (!customSpawnRules.isValidPosition(blockPos, serverLevel)) { +@@ -130,7 +_,7 @@ + if (!customSpawnRules.isValidPosition(blockPos, serverLevel)) { + continue; + } +- } else if (!SpawnPlacements.checkSpawnRules( ++ } else if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions && !SpawnPlacements.checkSpawnRules( // Sakura - configure mob spawner behaviour + optional.get(), serverLevel, EntitySpawnReason.SPAWNER, blockPos, serverLevel.getRandom() + )) { continue; +@@ -160,12 +_,19 @@ + return; } -- } else if (!SpawnPlacements.checkSpawnRules(optional.get(), serverLevel, EntitySpawnReason.SPAWNER, blockPos, serverLevel.getRandom())) { -+ } else if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions && !SpawnPlacements.checkSpawnRules(optional.get(), serverLevel, EntitySpawnReason.SPAWNER, blockPos, serverLevel.getRandom())) { // Sakura - configure mob spawner behaviour - continue; - } -@@ -150,12 +_,19 @@ - return; - } - -- int size = serverLevel.getEntities( -- EntityTypeTest.forExactClass(entity.getClass()), -- new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), -- EntitySelector.NO_SPECTATORS -- ) -- .size(); -+ // Sakura start - configure mob spawner behaviour -+ final int size; -+ if (serverLevel.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) { -+ size = 0; -+ } else { -+ size = serverLevel.getEntities( -+ EntityTypeTest.forExactClass(entity.getClass()), -+ new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), -+ EntitySelector.NO_SPECTATORS -+ ) -+ .size(); -+ } -+ // Sakura end - configure mob spawner behaviour - if (size >= this.maxNearbyEntities) { - this.delay(serverLevel, pos); - return; -@@ -164,8 +_,11 @@ - entity.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; preserve entity motion from tag - entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F); - if (entity instanceof Mob mob) { -- if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) -- || !mob.checkSpawnObstruction(serverLevel)) { +- int size = serverLevel.getEntities( +- EntityTypeTest.forExactClass(entity.getClass()), +- new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), +- EntitySelector.NO_SPECTATORS +- ) +- .size(); + // Sakura start - configure mob spawner behaviour -+ if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions && -+ (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) -+ || !mob.checkSpawnObstruction(serverLevel))) { -+ // Sakura end - configure mob spawner behaviour - continue; - } ++ final int size; ++ if (serverLevel.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) { ++ size = 0; ++ } else { ++ size = serverLevel.getEntities( ++ EntityTypeTest.forExactClass(entity.getClass()), ++ new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), ++ EntitySelector.NO_SPECTATORS ++ ) ++ .size(); ++ } ++ // Sakura end - configure mob spawner behaviour + if (size >= this.maxNearbyEntities) { + this.delay(serverLevel, pos); + return; +@@ -174,8 +_,11 @@ + entity.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; preserve entity motion from tag + entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F); + if (entity instanceof Mob mob) { +- if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) +- || !mob.checkSpawnObstruction(serverLevel)) { ++ // Sakura start - configure mob spawner behaviour ++ if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions && ++ (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) ++ || !mob.checkSpawnObstruction(serverLevel))) { ++ // Sakura end - configure mob spawner behaviour + continue; + } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch index 86e4310..f7f1cfa 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch @@ -8,15 +8,15 @@ // Paper start - collisions optimisations private static final double[] CACHED_RAYS; static { -@@ -323,6 +_,7 @@ - this.damageSource = damageSource == null ? level.damageSources().explosion(this) : damageSource; - this.damageCalculator = damageCalculator == null ? this.makeDamageCalculator(source) : damageCalculator; - this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit +@@ -326,6 +_,7 @@ + this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; + this.yield = Double.isFinite(this.yield) ? this.yield : 0; // Paper - Don't allow infinite default yields + // Paper end - add yield + this.consistentRadius = level.localConfig().config(BlockPos.containing(this.center)).consistentRadius; // Sakura - consistent explosion radius } private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) { -@@ -411,8 +_,7 @@ +@@ -414,8 +_,7 @@ final double incZ = CACHED_RAYS[ray + 2]; ray += 3; @@ -26,7 +26,7 @@ do { final int blockX = Mth.floor(currX); -@@ -619,7 +_,20 @@ +@@ -622,7 +_,20 @@ .onExplosionHit(this.level, blockPos, this, (itemStack, blockPos1) -> addOrAppendStack(list, itemStack, blockPos1)); } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch index affba4c..7c237aa 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -47,6 +_,11 @@ +@@ -46,6 +_,11 @@ private float progressO = 0.0F; private long lastTicked; private int deathTicks; @@ -12,7 +12,7 @@ public PistonMovingBlockEntity(BlockPos pos, BlockState blockState) { super(BlockEntityType.PISTON, pos, blockState); -@@ -363,6 +_,18 @@ +@@ -360,6 +_,18 @@ } public VoxelShape getCollisionShape(BlockGetter level, BlockPos pos) { diff --git a/sakura-server/paper-patches/features/0001-Client-Visibility-Settings.patch b/sakura-server/paper-patches/features/0001-Client-Visibility-Settings.patch index 0f2cc84..0b70753 100644 --- a/sakura-server/paper-patches/features/0001-Client-Visibility-Settings.patch +++ b/sakura-server/paper-patches/features/0001-Client-Visibility-Settings.patch @@ -5,33 +5,33 @@ Subject: [PATCH] Client Visibility Settings diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 8419ab4504de0a11149d01ca2bc5185af8821b18..9c15d1509252eb288c5265fc7989405544e1e157 100644 +index 2cdb2d19eb8a2650dc671d70438cddffd72140f3..a899c10a4d8335c9dad3b9b0abe3e4d63e76324a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2376,6 +2376,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2387,6 +2387,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { handle.expToDrop = data.getIntOr("expToDrop", 0); handle.keepLevel = data.getBooleanOr("keepLevel", false); }); + // Sakura start - client visibility settings; load from nbt -+ CompoundTag sakuraTag = tag.getCompoundOrEmpty("sakura"); -+ this.getHandle().visibilitySettings.loadData(sakuraTag); ++ input.child("sakura").ifPresent(sakura -> { ++ this.getHandle().visibilitySettings.loadData(sakura); ++ }); + // Sakura end - client visibility settings; load from nbt } - public void setExtraData(CompoundTag tag) { -@@ -2405,6 +2409,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + public void setExtraData(ValueOutput output) { +@@ -2408,6 +2413,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { paper.putLong("LastLogin", handle.loginTime); paper.putLong("LastSeen", System.currentTimeMillis()); // Paper end + // Sakura start - client visibility settings; save to nbt -+ CompoundTag sakuraTag = tag.getCompoundOrEmpty("sakura"); -+ this.getHandle().visibilitySettings.saveData(sakuraTag); -+ tag.put("sakura", sakuraTag); ++ final ValueOutput sakura = output.child("sakura"); ++ this.getHandle().visibilitySettings.saveData(sakura); + // Sakura end - client visibility settings; save to nbt } @Override -@@ -3071,6 +3080,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3074,6 +3083,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.getHandle().allowsListing(); } diff --git a/sakura-server/paper-patches/features/0002-Merge-Cannon-Entities.patch b/sakura-server/paper-patches/features/0002-Merge-Cannon-Entities.patch index d119122..ac45614 100644 --- a/sakura-server/paper-patches/features/0002-Merge-Cannon-Entities.patch +++ b/sakura-server/paper-patches/features/0002-Merge-Cannon-Entities.patch @@ -37,10 +37,10 @@ index e77b06c3ef9b534a8f4f160d077cf4339ee7622d..a33e91a5b35109415b8140721469217c @Override public FallingBlockEntity getHandle() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java -index eea78db7f12f5976077663a9ff0c0e188ffa8849..2e7803bd1f3411e75d8a51e03276b00469496f3b 100644 +index 4a62bd61ad3fcd59433e6cb7ddba3af39d714fef..0a5f3c51f2694ca7d05776817b2ddd40d9bc93aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java -@@ -12,6 +12,28 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { +@@ -13,6 +13,28 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { super(server, entity); } diff --git a/sakura-server/paper-patches/features/0004-Optimise-entity-scheduler-ticking.patch b/sakura-server/paper-patches/features/0004-Optimise-entity-scheduler-ticking.patch deleted file mode 100644 index 228e355..0000000 --- a/sakura-server/paper-patches/features/0004-Optimise-entity-scheduler-ticking.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samsuik -Date: Fri, 13 Sep 2024 17:22:51 +0100 -Subject: [PATCH] Optimise entity scheduler ticking - - -diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java -index c03608fec96b51e1867f43d8f42e5aefb1520e46..543251fc4973157dbb239729e656a8820fe88654 100644 ---- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java -+++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java -@@ -50,6 +50,22 @@ public final class EntityScheduler { - this.entity = Validate.notNull(entity); - } - -+ // Sakura start - optimise entity scheduler ticking -+ public boolean hasTask() { -+ return !this.currentlyExecuting.isEmpty() || !this.oneTimeDelayed.isEmpty(); -+ } -+ -+ private void newScheduledTask() { -+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { -+ Entity handle = this.entity.getHandleRaw(); -+ net.minecraft.server.level.ServerLevel level = (net.minecraft.server.level.ServerLevel) handle.level(); -+ ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup entityLookup = (ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup) level.moonrise$getEntityLookup(); -+ -+ entityLookup.entityStartScheduled(handle); -+ }); -+ } -+ // Sakura end - optimise entity scheduler ticking -+ - /** - * Retires the scheduler, preventing new tasks from being scheduled and invoking the retired callback - * on all currently scheduled tasks. -@@ -128,6 +144,7 @@ public final class EntityScheduler { - return new ArrayList<>(); - }).add(task); - } -+ this.newScheduledTask(); // Sakura - optimise entity scheduler ticking - - return true; - } diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch index 836573b..a666204 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1073,6 +_,7 @@ +@@ -1045,6 +_,7 @@ org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); @@ -8,7 +8,7 @@ for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) -@@ -1104,6 +_,7 @@ +@@ -1076,6 +_,7 @@ this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch index ac7dfa4..6e53102 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -283,6 +_,12 @@ +@@ -292,6 +_,12 @@ ).isValid(); } // Paper end diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch index 6c88840..0b91acf 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -165,6 +_,14 @@ +@@ -164,6 +_,14 @@ .defaultsTo(new File[] {}) .describedAs("Jar file"); @@ -12,6 +12,6 @@ + .describedAs("Config directory"); + // Sakura end - sakura configuration files + - acceptsAll(asList("server-name"), "Name of the server") + this.accepts("server-name", "Name of the server") .withRequiredArg() .ofType(String.class) diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch index 838bc65..4cd97bb 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -100,6 +_,18 @@ +@@ -113,6 +_,18 @@ this.entityType = CraftEntityType.minecraftToBukkit(entity.getType()); } diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch index 4a35a4b..863c14e 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -235,6 +_,18 @@ +@@ -246,6 +_,18 @@ this.firstPlayed = System.currentTimeMillis(); } diff --git a/sakura-server/src/main/java/me/samsuik/sakura/explosion/SpecialisedExplosion.java b/sakura-server/src/main/java/me/samsuik/sakura/explosion/SpecialisedExplosion.java index 17a5a57..66c0e6e 100644 --- a/sakura-server/src/main/java/me/samsuik/sakura/explosion/SpecialisedExplosion.java +++ b/sakura-server/src/main/java/me/samsuik/sakura/explosion/SpecialisedExplosion.java @@ -15,6 +15,7 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; +import java.util.Arrays; import java.util.List; import java.util.function.Consumer; @@ -43,16 +44,9 @@ public abstract class SpecialisedExplosion extends ServerExplo @Override public final void explode() { - if (this.radius() < 0.1F) { - // (radius < 0.1F) in bukkit is assumed to not be able to find any blocks or entities. - for (int i = this.getExplosionCount() - 1; i >= 0; --i) { - this.finalizeExplosionAndParticles(List.of()); - } - } else { - this.createBlockCache(); - this.startExplosion(); // search for blocks, impact entities, finalise if necessary - this.clearBlockCache(); - } + this.createBlockCache(); + this.startExplosion(); // search for blocks, impact entities, finalise if necessary + this.clearBlockCache(); } protected final boolean requiresImpactEntities(List blocks, Vec3 center) { @@ -87,7 +81,7 @@ public abstract class SpecialisedExplosion extends ServerExplo super.blockCache.clear(); } - java.util.Arrays.fill(this.directMappedBlockCache, null); + Arrays.fill(this.directMappedBlockCache, null); } protected final void recalculateExplosionPosition() { diff --git a/sakura-server/src/main/java/me/samsuik/sakura/player/visibility/PlayerVisibilitySettings.java b/sakura-server/src/main/java/me/samsuik/sakura/player/visibility/PlayerVisibilitySettings.java index 946cbd7..1dcf6b1 100644 --- a/sakura-server/src/main/java/me/samsuik/sakura/player/visibility/PlayerVisibilitySettings.java +++ b/sakura-server/src/main/java/me/samsuik/sakura/player/visibility/PlayerVisibilitySettings.java @@ -2,22 +2,24 @@ package me.samsuik.sakura.player.visibility; import it.unimi.dsi.fastutil.objects.Reference2ObjectMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; -import net.minecraft.nbt.CompoundTag; -import org.jetbrains.annotations.NotNull; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; import org.jspecify.annotations.NonNull; public final class PlayerVisibilitySettings implements VisibilitySettings { private static final String SETTINGS_COMPOUND_TAG = "clientVisibilitySettings"; private final Reference2ObjectMap visibilityStates = new Reference2ObjectOpenHashMap<>(); + @NonNull @Override - public @NonNull VisibilityState get(@NonNull VisibilityType type) { + public VisibilityState get(@NonNull VisibilityType type) { VisibilityState state = this.visibilityStates.get(type); return state != null ? state : type.getDefault(); } + @NonNull @Override - public @NotNull VisibilityState set(@NonNull VisibilityType type, @NonNull VisibilityState state) { + public VisibilityState set(@NonNull VisibilityType type, @NonNull VisibilityState state) { if (type.isDefault(state)) { this.visibilityStates.remove(type); } else { @@ -26,8 +28,9 @@ public final class PlayerVisibilitySettings implements VisibilitySettings { return state; } + @NonNull @Override - public @NonNull VisibilityState currentState() { + public VisibilityState currentState() { int modifiedCount = this.visibilityStates.size(); if (modifiedCount == 0) { return VisibilityState.ON; @@ -43,18 +46,18 @@ public final class PlayerVisibilitySettings implements VisibilitySettings { return !this.visibilityStates.isEmpty(); } - public void loadData(@NonNull CompoundTag tag) { - CompoundTag settingsTag = tag.getCompoundOrEmpty(SETTINGS_COMPOUND_TAG); - for (VisibilityType type : VisibilityTypes.types()) { - String typeKey = type.key(); - String stateName = settingsTag.getStringOr(typeKey, type.getDefault().name()); - this.set(type, VisibilityState.valueOf(stateName)); - } + public void loadData(@NonNull ValueInput input) { + input.child(SETTINGS_COMPOUND_TAG).ifPresent(settings -> { + for (VisibilityType type : VisibilityTypes.types()) { + String typeKey = type.key(); + String stateName = settings.getStringOr(typeKey, type.getDefault().name()); + this.set(type, VisibilityState.valueOf(stateName)); + } + }); } - public void saveData(@NonNull CompoundTag tag) { - CompoundTag settingsTag = new CompoundTag(); - this.visibilityStates.forEach((t, s) -> settingsTag.putString(t.key(), s.name())); - tag.put(SETTINGS_COMPOUND_TAG, settingsTag); + public void saveData(@NonNull ValueOutput output) { + ValueOutput settings = output.child(SETTINGS_COMPOUND_TAG); + this.visibilityStates.forEach((type, state) -> settings.putString(type.key(), state.name())); } }