diff --git a/gradle.properties b/gradle.properties index ef5071a..fbc45b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=me.samsuik.sakura version=1.21.10-R0.1-SNAPSHOT mcVersion=1.21.10 -paperRef=fba780d6a2948d5a42030a80cf79cb49a8472456 +paperRef=ab99393c0707baedff2c57c43a359d416b09442d org.gradle.jvmargs=-Xmx2G org.gradle.vfs.watch=false diff --git a/sakura-server/build.gradle.kts.patch b/sakura-server/build.gradle.kts.patch index d3e5f23..3b6de0a 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 -@@ -15,6 +_,7 @@ +@@ -12,6 +_,7 @@ } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" +val serverBrand = rootProject.name dependencies { - mache("io.papermc:mache:1.21.10+build.1") -@@ -26,6 +_,17 @@ + mache("io.papermc:mache:1.21.10+build.4") +@@ -23,6 +_,17 @@ minecraftVersion = providers.gradleProperty("mcVersion") gitFilePatches = false @@ -26,7 +26,7 @@ spigot { enabled = true buildDataRef = "42d18d4c4653ffc549778dbe223f6994a031d69e" -@@ -107,7 +_,20 @@ +@@ -104,7 +_,20 @@ } } @@ -48,7 +48,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { extendsFrom(configurations.compileClasspath.get()) } -@@ -130,7 +_,7 @@ +@@ -127,7 +_,7 @@ } dependencies { @@ -57,7 +57,7 @@ implementation("ca.spottedleaf:concurrentutil:0.0.5") implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 -@@ -207,7 +_,7 @@ +@@ -204,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, -@@ -266,7 +_,7 @@ +@@ -263,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 4bdba95..b2f2262 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 252fefa6e19b2109d1b228b62a900b038766fbdd..a854d5cbb4cb78795f40e4b2dd81aa773fd3978b 100644 +index cbba36914e41f230f7003539e9ddfba2d570641d..b4b177fd7732960a5cf528e110c8b7160165fad7 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1809,6 +1809,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entityType, Level level) { - this.type = entityType; + public Entity(EntityType type, Level level) { + this.type = type; diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 31e0739bc20096fa368f2b22bb45034a6fe1fe43..c7a930caa2264c9465baf61a0ed8a188119f28c8 100644 +index 7b67387d3bb66b1c8ab77e1805c9530a8f1ffa3c..8150b567c05d2c8e87f4b65d616d5c0c01bc2e19 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -79,6 +79,7 @@ public class FallingBlockEntity extends Entity { - super(entityType, level); + super(type, 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 + this.isFallingBlock = true; // Sakura - client visibility settings @@ -295,12 +295,12 @@ index 31e0739bc20096fa368f2b22bb45034a6fe1fe43..c7a930caa2264c9465baf61a0ed8a188 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 df5b6c6c06fc594c3d51e59bab59a625ac1e4bae..4d0bc49ce0868d7a5a1870be4e19eb08f3f31482 100644 +index 18162042ee54e54bc4539a7a01a1fc88cc9b3f3a..71071899443fdb02beb0321f271430c732178e26 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java @@ -63,6 +63,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { - public PrimedTnt(EntityType entityType, Level level) { - super(entityType, level); + public PrimedTnt(EntityType type, Level level) { + super(type, level); this.blocksBuilding = true; + this.isPrimedTNT = true; // Sakura - client visibility settings } 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 f8f07f7..9888802 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 @@ -62,7 +62,7 @@ index 25ea504fa93f78b43237e1c79f8b5685a2aa6d7c..5395b3e0491f197ffea3910d3f172dcd private static TicketType register(String name, long timeout, int flags) { return Registry.register(BuiltInRegistries.TICKET_TYPE, name, new TicketType(timeout, flags)); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 9644382065aa9e3c611e62b3679f753ea5390e33..82f8f4bbadf569fd64d3babbb988ebcd7abe59b2 100644 +index e9c536a11e403e1c979e01d21bfd3d167e439903..e8f262dd220e07a8b70e931274535f3c474d24a4 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -539,6 +539,19 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @@ -83,8 +83,8 @@ index 9644382065aa9e3c611e62b3679f753ea5390e33..82f8f4bbadf569fd64d3babbb988ebcd + } + // Sakura end - load chunks on movement - public Entity(EntityType entityType, Level level) { - this.type = entityType; + public Entity(EntityType type, Level level) { + this.type = type; @@ -1540,7 +1553,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getCollisionsForBlocksOrWorldBorder( @@ -94,7 +94,7 @@ index 9644382065aa9e3c611e62b3679f753ea5390e33..82f8f4bbadf569fd64d3babbb988ebcd ); potentialCollisionsBB.addAll(entityAABBs); final Vec3 collided = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.performCollisions(movement, currentBox, potentialCollisionsVoxel, potentialCollisionsBB); -@@ -5243,13 +5256,14 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -5242,13 +5255,14 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @Override public boolean shouldBeSaved() { return (this.removalReason == null || this.removalReason.shouldSave()) @@ -111,7 +111,7 @@ index 9644382065aa9e3c611e62b3679f753ea5390e33..82f8f4bbadf569fd64d3babbb988ebcd 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 c7a930caa2264c9465baf61a0ed8a188119f28c8..44f04d0a6b1a47fa152f955a22cc8b8f1d2b3348 100644 +index 8150b567c05d2c8e87f4b65d616d5c0c01bc2e19..d1f806f950707091d02788117c1f8cffe5b2de04 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -80,6 +80,7 @@ public class FallingBlockEntity extends Entity { @@ -123,11 +123,11 @@ index c7a930caa2264c9465baf61a0ed8a188119f28c8..44f04d0a6b1a47fa152f955a22cc8b8f 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 4d0bc49ce0868d7a5a1870be4e19eb08f3f31482..2572c0fe5fc6bd2f389569cdaa907a8b5203f5b4 100644 +index 71071899443fdb02beb0321f271430c732178e26..dd4e2419892a8879106eaaccbf406bec12bbd017 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 { - super(entityType, level); + super(type, level); this.blocksBuilding = true; this.isPrimedTNT = true; // Sakura - client visibility settings + this.loadChunks = level.sakuraConfig().cannons.loadChunks; // Sakura - load chunks on movement @@ -135,7 +135,7 @@ index 4d0bc49ce0868d7a5a1870be4e19eb08f3f31482..2572c0fe5fc6bd2f389569cdaa907a8b 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 9889485b15501c1adf1a73bb4603d3477860482d..833048754d7f60ad7f528f38c7d34804e1bf5ee1 100644 +index 98b7e1e3b8592824c69a9647a82621755526c71a..6c997cb573a489f9ca0b7ffe278de5f66e667aa8 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java @@ -137,6 +137,15 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh 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 c41d67e..8014d3b 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 @@ -153,20 +153,20 @@ index 638432a2e6506d3db6a25c068a33eeafb13cf0d6..c386288e808e97c938f1909d81ebfa00 if (this.entity instanceof LivingEntity) { diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 82f8f4bbadf569fd64d3babbb988ebcd7abe59b2..f66cc3104a4d3f61833ef6fdae79ef4a480aa2dd 100644 +index e8f262dd220e07a8b70e931274535f3c474d24a4..a7139549066914b3bc318bc409b392645344b3c4 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -3708,7 +3708,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name - this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID); +@@ -3707,7 +3707,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name + this.entityData.markDirty(DATA_AIR_SUPPLY_ID); return; } -- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount()); -+ this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount(), getMaxAirSupply()); // Slice +- this.entityData.set(DATA_AIR_SUPPLY_ID, event.getAmount()); ++ this.entityData.set(DATA_AIR_SUPPLY_ID, event.getAmount(), this.getMaxAirSupply()); // Slice - packet obfuscation and reduction // CraftBukkit end } diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 44f04d0a6b1a47fa152f955a22cc8b8f1d2b3348..59aa539b7d830de48ff582b0da6fa17796b8c4b8 100644 +index d1f806f950707091d02788117c1f8cffe5b2de04..a4fd6b0a6762ce4d9e488f305dd2abe1e43edbd8 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -144,7 +144,7 @@ public class FallingBlockEntity extends Entity { @@ -179,7 +179,7 @@ index 44f04d0a6b1a47fa152f955a22cc8b8f1d2b3348..59aa539b7d830de48ff582b0da6fa177 public BlockPos getStartPos() { diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index 2572c0fe5fc6bd2f389569cdaa907a8b5203f5b4..6797e16f973b11d168906dfce240c70db25bc6f0 100644 +index dd4e2419892a8879106eaaccbf406bec12bbd017..ef61333619d772a3acba6e2f6997655016b399f9 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java @@ -228,7 +228,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -196,7 +196,7 @@ index 2572c0fe5fc6bd2f389569cdaa907a8b5203f5b4..6797e16f973b11d168906dfce240c70d public int getFuse() { diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java -index e2d5426b6c88dd3fbc64864b8bbd9a39a3ffa4ee..4a8ec0354ccc81dea6dac795975b59895b00f07f 100644 +index 0d19e0c6d8a2a7a26dfb594a2cd8f1a533347690..5f214aaad020552d2db143a1f7a33e8c858731a0 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java @@ -580,7 +580,7 @@ public abstract class Player extends Avatar implements ContainerUser { @@ -207,4 +207,4 @@ index e2d5426b6c88dd3fbc64864b8bbd9a39a3ffa4ee..4a8ec0354ccc81dea6dac795975b5989 + this.entityData.set(DATA_SCORE_ID, score1 + score, 0); // Slice - packet obfuscation and reduction } - public void startAutoSpinAttack(int ticks, float damage, ItemStack itemStack) { + public void startAutoSpinAttack(int ticks, float damageAmount, ItemStack stack) { diff --git a/sakura-server/minecraft-patches/features/0005-Add-redstone-implementation-api.patch b/sakura-server/minecraft-patches/features/0005-Add-redstone-implementation-api.patch index f67026e..e1918cb 100644 --- a/sakura-server/minecraft-patches/features/0005-Add-redstone-implementation-api.patch +++ b/sakura-server/minecraft-patches/features/0005-Add-redstone-implementation-api.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add redstone implementation api diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index 8268ac128d0a2dfb9eee9a46630862bdd04a747e..7390a21f7c6991d3fb62fda9e88bc9212159177b 100644 +index 052ca983df58329d513373e14a0ed726005edd9b..fc75ecd9f56526b213b348d1243834eb21abfc34 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -275,7 +275,7 @@ public class RedStoneWireBlock extends Block { @@ -18,7 +18,7 @@ index 8268ac128d0a2dfb9eee9a46630862bdd04a747e..7390a21f7c6991d3fb62fda9e88bc921 // when this is not null, it can be used to find the source pos, which the turbo uses // to find the direction of information flow @@ -348,7 +348,7 @@ public class RedStoneWireBlock extends Block { - protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) { + protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { if (!oldState.is(state.getBlock()) && !level.isClientSide()) { // Paper start - optimize redstone - replace call to updatePowerStrength - if (level.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { 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 4f87e90..202034c 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,7 +5,7 @@ Subject: [PATCH] Store Entity Data/State diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index eb157e848ea97ea11bbf233d473e6a62a23bf32f..127479da921c2679e19f13e71cc04be8a310b459 100644 +index a7139549066914b3bc318bc409b392645344b3c4..4c327ed5103dcab2e97fb85d4c302dd26e57858d 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -552,6 +552,21 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @@ -28,10 +28,10 @@ index eb157e848ea97ea11bbf233d473e6a62a23bf32f..127479da921c2679e19f13e71cc04be8 + } + // Sakura end - store entity data/state - public Entity(EntityType entityType, Level level) { - this.type = entityType; + public Entity(EntityType type, Level level) { + this.type = type; diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 4b2ea3c99bcd5452840b26c2ba607a4f034ba367..5f49990b13ac7fdd4366585d976d50bd3ae183cb 100644 +index f8ea7e4536f6e0584c65ea9e20fe63f1cc343425..0900ae1072c9dfa70cad0e4f3dc7b916ed96319f 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -1448,6 +1448,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl 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 0d104bb..d35c910 100644 --- a/sakura-server/minecraft-patches/features/0008-Merge-Cannon-Entities.patch +++ b/sakura-server/minecraft-patches/features/0008-Merge-Cannon-Entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Merge Cannon Entities diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 477c3436d6586a9fd9f0486bc8102808c15c5bae..4bf46b1a7ce64f39ca7d4e915001f54391a3e89c 100644 +index ca98972697fe2961402bea4cfb0cf86ea80a92f0..a42a0672d56e32baaa594c9c1b9db0e7487e7d59 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -716,6 +716,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -41,7 +41,7 @@ index 477c3436d6586a9fd9f0486bc8102808c15c5bae..4bf46b1a7ce64f39ca7d4e915001f543 this.guardEntityTick(this::tickNonPassenger, entity); profilerFiller.pop(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 5fd20439dd1686e5f2ee20d3f89dab78932d5a15..f7d0b0017ebcec507d88f90c9b894cbf51e3511a 100644 +index 4c327ed5103dcab2e97fb85d4c302dd26e57858d..24649fb3328a67d654795824ff7f68e93425c448 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -567,6 +567,27 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @@ -70,9 +70,9 @@ index 5fd20439dd1686e5f2ee20d3f89dab78932d5a15..f7d0b0017ebcec507d88f90c9b894cbf + } + // Sakura end - merge cannon entities - public Entity(EntityType entityType, Level level) { - this.type = entityType; -@@ -5236,6 +5257,11 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name + public Entity(EntityType type, Level level) { + this.type = type; +@@ -5235,6 +5256,11 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name 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,7 +85,7 @@ index 5fd20439dd1686e5f2ee20d3f89dab78932d5a15..f7d0b0017ebcec507d88f90c9b894cbf 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 59aa539b7d830de48ff582b0da6fa17796b8c4b8..af7dd04ecbf9e8b35357da421fb156aee61261b5 100644 +index a4fd6b0a6762ce4d9e488f305dd2abe1e43edbd8..cdce0160bc4eeacfd5e7751a0d6d4192d4832c53 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -53,7 +53,7 @@ import net.minecraft.world.phys.HitResult; @@ -151,8 +151,8 @@ index 59aa539b7d830de48ff582b0da6fa17796b8c4b8..af7dd04ecbf9e8b35357da421fb156ae + } + // Sakura end - merge cannon entities + - public FallingBlockEntity(EntityType entityType, Level level) { - super(entityType, level); + public FallingBlockEntity(EntityType type, Level level) { + super(type, 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 this.isFallingBlock = true; // Sakura - client visibility settings @@ -190,7 +190,7 @@ index 59aa539b7d830de48ff582b0da6fa17796b8c4b8..af7dd04ecbf9e8b35357da421fb156ae 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 6797e16f973b11d168906dfce240c70db25bc6f0..8a36e0ce4792e7152905256dde7746fd09d42729 100644 +index ef61333619d772a3acba6e2f6997655016b399f9..06e2f16032d615bf0083376ce3496941cbdf7ab0 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java @@ -34,7 +34,7 @@ import org.bukkit.event.entity.EntityRemoveEvent; @@ -242,8 +242,8 @@ index 6797e16f973b11d168906dfce240c70db25bc6f0..8a36e0ce4792e7152905256dde7746fd + } + // Sakura end - merge cannon entities + - public PrimedTnt(EntityType entityType, Level level) { - super(entityType, level); + public PrimedTnt(EntityType type, Level level) { + super(type, level); this.blocksBuilding = true; this.isPrimedTNT = true; // Sakura - client visibility settings this.loadChunks = level.sakuraConfig().cannons.loadChunks; // Sakura - load chunks on movement @@ -280,7 +280,7 @@ index 6797e16f973b11d168906dfce240c70db25bc6f0..8a36e0ce4792e7152905256dde7746fd @Nullable diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 5f49990b13ac7fdd4366585d976d50bd3ae183cb..93ff0fdaee21ac493833640b5f620f9bec1a69c8 100644 +index 0900ae1072c9dfa70cad0e4f3dc7b916ed96319f..00a0b07aae109203dff96ac4f2aef67f5592c05e 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -833,6 +833,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -292,7 +292,7 @@ index 5f49990b13ac7fdd4366585d976d50bd3ae183cb..93ff0fdaee21ac493833640b5f620f9b protected Level( WritableLevelData levelData, diff --git a/net/minecraft/world/level/block/BasePressurePlateBlock.java b/net/minecraft/world/level/block/BasePressurePlateBlock.java -index 02289b88710f9305192e3fa7eed3e7c45eda1178..2ca8c39c4883ff7f398ed931d560e7cfcf474e1a 100644 +index 0dc714bf96545bc86cc5cd32849c3be817580d33..2a6e924425b5cf81b28b34ea740f5481d590d829 100644 --- a/net/minecraft/world/level/block/BasePressurePlateBlock.java +++ b/net/minecraft/world/level/block/BasePressurePlateBlock.java @@ -92,7 +92,7 @@ public abstract class BasePressurePlateBlock extends Block { 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 518c851..d495e04 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,7 +5,7 @@ Subject: [PATCH] Optimise cannon entity movement diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index f7d0b0017ebcec507d88f90c9b894cbf51e3511a..128f62186d18186b7ba3a0c40a2723b8a933e8fb 100644 +index 24649fb3328a67d654795824ff7f68e93425c448..31fa5bb8a9d0076ea8072177f298f55ae3e2ee59 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -1203,7 +1203,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @@ -151,7 +151,7 @@ index f7d0b0017ebcec507d88f90c9b894cbf51e3511a..128f62186d18186b7ba3a0c40a2723b8 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 af7dd04ecbf9e8b35357da421fb156aee61261b5..0344ba2a6d063a4ee5d6f9a8985ae8ca8c5816ce 100644 +index cdce0160bc4eeacfd5e7751a0d6d4192d4832c53..00d0cabd7d190e6258b595c372440b0fd06311a4 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -124,6 +124,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -165,10 +165,10 @@ index af7dd04ecbf9e8b35357da421fb156aee61261b5..0344ba2a6d063a4ee5d6f9a8985ae8ca + } + // Sakura end - optimise cannon entity movement - public FallingBlockEntity(EntityType entityType, Level level) { - super(entityType, level); + public FallingBlockEntity(EntityType type, Level level) { + super(type, level); diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index b349149592b09512b573911e95fd13915ba698cd..05003798585d98406cd1affb89403b9f955bacdc 100644 +index 8554e1e95d921eac7b0a6aa7afaa2b3b6e09f423..dee0b2f7ace916d9d3206b2dac166d14d62c8fde 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java @@ -82,6 +82,12 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -182,5 +182,5 @@ index b349149592b09512b573911e95fd13915ba698cd..05003798585d98406cd1affb89403b9f + } + // Sakura end - optimise cannon entity movement - public PrimedTnt(EntityType entityType, Level level) { - super(entityType, level); + public PrimedTnt(EntityType type, Level level) { + super(type, level); 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 c5b9111..7cf0661 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 53053302b38e7a82c55234f4808f2629814d4e57..e04be1dc74b2fc76b98b9d364b1a212f20d5356a 100644 +index 70b0604a279b66dc3e1087a03e9e0a1123fb63ee..d238e26628e790b46a36ebcae56e4d900e97b595 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -3782,7 +3782,17 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3788,7 +3788,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/0017-Configure-cannon-physics.patch b/sakura-server/minecraft-patches/features/0017-Configure-cannon-physics.patch index 2eb6f68..7e0783a 100644 --- a/sakura-server/minecraft-patches/features/0017-Configure-cannon-physics.patch +++ b/sakura-server/minecraft-patches/features/0017-Configure-cannon-physics.patch @@ -83,7 +83,7 @@ index 703a75c7c6cd05a95afb630973250898dbc7223d..1531f0c275814e1346fef34dc06ea976 // CraftBukkit end serverLevel.addFreshEntity(primedTnt); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 128f62186d18186b7ba3a0c40a2723b8a933e8fb..c7f1cbd6aa044a434b193e7e0b1f34bf11b6c4e6 100644 +index 31fa5bb8a9d0076ea8072177f298f55ae3e2ee59..e19de1e6c38ec2375a24808d22525ec3f9178461 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -588,6 +588,13 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @@ -98,8 +98,8 @@ index 128f62186d18186b7ba3a0c40a2723b8a933e8fb..c7f1cbd6aa044a434b193e7e0b1f34bf + } + // Sakura end - configure server mechanics - public Entity(EntityType entityType, Level level) { - this.type = entityType; + public Entity(EntityType type, Level level) { + this.type = type; @@ -1116,7 +1123,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } @@ -311,7 +311,7 @@ index 128f62186d18186b7ba3a0c40a2723b8a933e8fb..c7f1cbd6aa044a434b193e7e0b1f34bf Vec3 vec3 = to.subtract(from); return aabb.collidedAlongVector(vec3, boxes); diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java -index 0344ba2a6d063a4ee5d6f9a8985ae8ca8c5816ce..02dc6c5965354047fc05ad3d3293c7f6277f50cd 100644 +index 00d0cabd7d190e6258b595c372440b0fd06311a4..46d7f001d299ed6bb7987fe3c06c9cd1651bda80 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -130,6 +130,25 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -338,8 +338,8 @@ index 0344ba2a6d063a4ee5d6f9a8985ae8ca8c5816ce..02dc6c5965354047fc05ad3d3293c7f6 + } + // Sakura end - configure server mechanics - public FallingBlockEntity(EntityType entityType, Level level) { - super(entityType, level); + public FallingBlockEntity(EntityType type, Level level) { + super(type, level); @@ -150,6 +169,10 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti this.yo = y; this.zo = z; @@ -352,13 +352,13 @@ index 0344ba2a6d063a4ee5d6f9a8985ae8ca8c5816ce..02dc6c5965354047fc05ad3d3293c7f6 // Sakura start - falling block height parity api @@ -181,7 +204,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti - blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState + state.hasProperty(BlockStateProperties.WATERLOGGED) ? state.setValue(BlockStateProperties.WATERLOGGED, false) : state ); - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(fallingBlockEntity, pos, blockState.getFluidState().createLegacyBlock())) return fallingBlockEntity; // CraftBukkit -- level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3); + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(fallingBlockEntity, pos, state.getFluidState().createLegacyBlock())) return fallingBlockEntity; // CraftBukkit +- level.setBlock(pos, state.getFluidState().createLegacyBlock(), 3); + // Sakura start - configure server mechanics + if (fallingBlockEntity.mechanicsTarget.atLeast(me.samsuik.sakura.mechanics.MechanicVersion.v1_18_2)) { -+ level.setBlock(pos, blockState.getFluidState().createLegacyBlock(), 3); ++ level.setBlock(pos, state.getFluidState().createLegacyBlock(), 3); + } + // Sakura end - configure server mechanics level.addFreshEntity(fallingBlockEntity); @@ -436,7 +436,7 @@ index 0344ba2a6d063a4ee5d6f9a8985ae8ca8c5816ce..02dc6c5965354047fc05ad3d3293c7f6 } diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index 05003798585d98406cd1affb89403b9f955bacdc..cb2241e99f4b3bee099ff1eea566beb9bd80c57d 100644 +index dee0b2f7ace916d9d3206b2dac166d14d62c8fde..646ad687b92753b690050e9b0cdeaa517a1403cd 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java @@ -88,6 +88,23 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -461,8 +461,8 @@ index 05003798585d98406cd1affb89403b9f955bacdc..cb2241e99f4b3bee099ff1eea566beb9 + } + // Sakura end - configure server mechanics - public PrimedTnt(EntityType entityType, Level level) { - super(entityType, level); + public PrimedTnt(EntityType type, Level level) { + super(type, level); @@ -113,6 +130,13 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak case Y -> this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0)); } @@ -544,7 +544,7 @@ index 05003798585d98406cd1affb89403b9f955bacdc..cb2241e99f4b3bee099ff1eea566beb9 // 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 41c036324499d4e408030d1e19f78468b6b3d8a6..3c2f5d40bccaf6582a41079d1c47eb228c72a6ff 100644 +index 867846ce62ffc5440d07084c79b2dd752bbe82c9..bf232ac4a4933c125535f8ea959d07fbcca58336 100644 --- a/net/minecraft/world/level/BlockGetter.java +++ b/net/minecraft/world/level/BlockGetter.java @@ -8,6 +8,8 @@ import java.util.function.Function; @@ -711,7 +711,7 @@ index b13aae809e974b42bc1b17f4f4455999adca6f5f..0a279388e965a8d059189a8dfdbec3ff // Sakura end - replace density cache } diff --git a/net/minecraft/world/level/block/FallingBlock.java b/net/minecraft/world/level/block/FallingBlock.java -index 4fa238d1cd6b19f16c0d0a8a9a913e9e42debbed..96a02601636cdf7cf6e360fc933e5764fbb7eab8 100644 +index 24b9ce38bc144febeefc2304242e96243533a01c..ecd93719347d21b9d1dbe6515e1be873515f4732 100644 --- a/net/minecraft/world/level/block/FallingBlock.java +++ b/net/minecraft/world/level/block/FallingBlock.java @@ -45,6 +45,22 @@ public abstract class FallingBlock extends Block implements Fallable { @@ -760,11 +760,11 @@ index 0c6ae65fc58d63a0b80f3bc1ffa0c9a1bb33de83..f291dc3b3f3e3b8da221f42580ed26c4 level.playSound( null, diff --git a/net/minecraft/world/level/block/HoneyBlock.java b/net/minecraft/world/level/block/HoneyBlock.java -index 009f6b118e227b8a037a7b39b7d4a319518e5765..0a9009dc26edb0c6904cdf484463c5c33e5099de 100644 +index 25dd5b720d868f89d1e68acc391aff74f3accbe1..e744681f645ef7045ecab264c15f6be0f189831d 100644 --- a/net/minecraft/world/level/block/HoneyBlock.java +++ b/net/minecraft/world/level/block/HoneyBlock.java @@ -71,11 +71,19 @@ public class HoneyBlock extends HalfTransparentBlock { - super.entityInside(state, level, pos, entity, effectApplier, flag); + super.entityInside(state, level, pos, entity, effectApplier, pastEdges); } - private static double getOldDeltaY(double deltaY) { @@ -813,7 +813,7 @@ index 009f6b118e227b8a037a7b39b7d4a319518e5765..0a9009dc26edb0c6904cdf484463c5c3 entity.resetFallDistance(); diff --git a/net/minecraft/world/level/block/LadderBlock.java b/net/minecraft/world/level/block/LadderBlock.java -index f9c305de60a323b450a26c9d7de50a824492cf5a..c4987294763a82f5f065f726d48fa61dda097f6a 100644 +index b895dbe24fb567d1161107b944a24a325967c061..c761d15236c0f78eeca26d0a828866fdf9c059fd 100644 --- a/net/minecraft/world/level/block/LadderBlock.java +++ b/net/minecraft/world/level/block/LadderBlock.java @@ -33,6 +33,15 @@ public class LadderBlock extends Block implements SimpleWaterloggedBlock { @@ -845,10 +845,10 @@ index f9c305de60a323b450a26c9d7de50a824492cf5a..c4987294763a82f5f065f726d48fa61d } diff --git a/net/minecraft/world/level/block/LiquidBlock.java b/net/minecraft/world/level/block/LiquidBlock.java -index 0b1ec05fcd799536c8d7393bb42dc4b2f46ca48b..5968a30d21367b882501bbb70029b9e0069cca9f 100644 +index 3a432dc812579c19e1982126b5cfd003814e0dcf..4449addb934033776558e5c549c66da9551201fc 100644 --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java -@@ -199,7 +199,14 @@ public class LiquidBlock extends Block implements BucketPickup { +@@ -201,7 +201,14 @@ public class LiquidBlock extends Block implements BucketPickup { } // Sakura end - configure fluid ticking outside the world border if (level.getFluidState(blockPos).is(FluidTags.WATER)) { @@ -865,7 +865,7 @@ index 0b1ec05fcd799536c8d7393bb42dc4b2f46ca48b..5968a30d21367b882501bbb70029b9e0 if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState(), 3)) { this.fizz(level, pos); diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index 4c6c68eedba2d5acdde6cf760e53b8e81f75f001..ce27dfb14974d452f50c191a3eeec65d3deff6a3 100644 +index fc75ecd9f56526b213b348d1243834eb21abfc34..9720c55536d09377d1fbcbf1af4acb3caa9952f2 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -322,6 +322,10 @@ public class RedStoneWireBlock extends Block { @@ -889,7 +889,7 @@ index 4c6c68eedba2d5acdde6cf760e53b8e81f75f001..ce27dfb14974d452f50c191a3eeec65d } else { if (isCross(state) || isDot(state)) { diff --git a/net/minecraft/world/level/block/WaterlilyBlock.java b/net/minecraft/world/level/block/WaterlilyBlock.java -index cbb81c8bf5f689f276e74548ce324a8c35357e3a..bdd0b1bcb97d9505d49994737f4c847e3423b1f9 100644 +index f8e2127c2ea65a7b6b1193da3d0b0a6d367fc947..6ccef336e5a2fccc198c7a22b8a73d6ec71babaa 100644 --- a/net/minecraft/world/level/block/WaterlilyBlock.java +++ b/net/minecraft/world/level/block/WaterlilyBlock.java @@ -24,6 +24,15 @@ public class WaterlilyBlock extends VegetationBlock { @@ -921,7 +921,7 @@ index cbb81c8bf5f689f276e74548ce324a8c35357e3a..bdd0b1bcb97d9505d49994737f4c847e } diff --git a/net/minecraft/world/level/block/piston/MovingPistonBlock.java b/net/minecraft/world/level/block/piston/MovingPistonBlock.java -index 16f14dffcbca21e0c6d369d557ab6c036523b8bd..f459cee5a4d0eafccc525c246964acc9272429f5 100644 +index 9f013b6a87a18f83188d6efec9f84d8895876f24..a091246071719aeaad3ec4f6beb4cfd1902ad5ca 100644 --- a/net/minecraft/world/level/block/piston/MovingPistonBlock.java +++ b/net/minecraft/world/level/block/piston/MovingPistonBlock.java @@ -100,6 +100,16 @@ public class MovingPistonBlock extends BaseEntityBlock { @@ -942,7 +942,7 @@ index 16f14dffcbca21e0c6d369d557ab6c036523b8bd..f459cee5a4d0eafccc525c246964acc9 } diff --git a/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index 384eb75c644489fecd78fff904612ebe1e3e1706..87bc3222c33a00a46c5fdff792ca11f8248a61cd 100644 +index 4bf4c3a8dcdcb9c6b8d722d05f7cb7fbfb78ddef..7012f90689592600bab03060c2c45bd45cc079ff 100644 --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -122,6 +122,11 @@ public class PistonBaseBlock extends DirectionalBlock { @@ -958,7 +958,7 @@ index 384eb75c644489fecd78fff904612ebe1e3e1706..87bc3222c33a00a46c5fdff792ca11f8 } } diff --git a/net/minecraft/world/level/block/piston/PistonHeadBlock.java b/net/minecraft/world/level/block/piston/PistonHeadBlock.java -index 72e39ceeca8d684569c4250263b41034362f8abd..0f723f8eb814931f949b1a467b79266e9a6e7f9e 100644 +index 8c35c7e54373f8be187a84bd4b4a9ce9d6341dff..bd7c33204a430a862e8abd2683afd92c5af77fa8 100644 --- a/net/minecraft/world/level/block/piston/PistonHeadBlock.java +++ b/net/minecraft/world/level/block/piston/PistonHeadBlock.java @@ -3,6 +3,8 @@ package net.minecraft.world.level.block.piston; @@ -994,7 +994,7 @@ index 72e39ceeca8d684569c4250263b41034362f8abd..0f723f8eb814931f949b1a467b79266e } diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index 4c4dbd7ade2b8836064242bb43eeb871cac023ce..7816e0ab95634d93ced2dea47aa58edc087f2caa 100644 +index a50f572ef71a133fa29a5d967a26477218431762..61f48991232be5b32472c97073c8990cce8706a9 100644 --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java @@ -64,6 +64,165 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -1236,34 +1236,34 @@ index 4c4dbd7ade2b8836064242bb43eeb871cac023ce..7816e0ab95634d93ced2dea47aa58edc } diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java -index c8e427907c17ae6ac6c4dbe6abe74955c8030ead..f7209a487a48e434fde91daa39466de16ead03f2 100644 +index 7449be23b48c2b08415e2de97348ec24b99395cc..f383c6b8f1aefb66fc4a0c54c895a700e7c62f62 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java @@ -185,6 +185,11 @@ public abstract class LavaFluid extends FlowingFluid { @Override - public boolean canBeReplacedWith(FluidState fluidState, BlockGetter blockReader, BlockPos pos, Fluid fluid, Direction direction) { + public boolean canBeReplacedWith(FluidState fluidState, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction) { + // Sakura start - configure server mechanics -+ if (blockReader instanceof Level level && level.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13)) { ++ if (level instanceof ServerLevel serverLevel && serverLevel.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13)) { + return false; + } + // Sakura end - configure server mechanics - return fluidState.getHeight(blockReader, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); + return fluidState.getHeight(level, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); } diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java -index 10e3c644e31650b0e1aad6349a83a763cf744ec8..62b90ee5c3ecdd82e0fbb7a7812cd59e8cbde567 100644 +index b00dae925acf05d11566af2d9e098c393f525fdb..82b7e176e61e71006be8632c42daae64d89cf11c 100644 --- a/net/minecraft/world/level/material/WaterFluid.java +++ b/net/minecraft/world/level/material/WaterFluid.java @@ -124,7 +124,13 @@ public abstract class WaterFluid extends FlowingFluid { @Override - public boolean canBeReplacedWith(FluidState fluidState, BlockGetter blockReader, BlockPos pos, Fluid fluid, Direction direction) { + public boolean canBeReplacedWith(FluidState fluidState, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction) { - return direction == Direction.DOWN && !fluid.is(FluidTags.WATER); + // Sakura start - configure server mechanics + final boolean canReplace = direction == Direction.DOWN -+ || blockReader instanceof Level level -+ && level.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13); ++ || level instanceof ServerLevel serverLevel ++ && serverLevel.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13); + // Before 1.13 lava could replace water + return canReplace && !fluid.is(FluidTags.WATER); + // Sakura end - configure server mechanics diff --git a/sakura-server/minecraft-patches/features/0021-Legacy-lava-block-formation.patch b/sakura-server/minecraft-patches/features/0021-Legacy-lava-block-formation.patch index ca2ac2a..46951a9 100644 --- a/sakura-server/minecraft-patches/features/0021-Legacy-lava-block-formation.patch +++ b/sakura-server/minecraft-patches/features/0021-Legacy-lava-block-formation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Legacy lava block formation diff --git a/net/minecraft/world/level/block/LiquidBlock.java b/net/minecraft/world/level/block/LiquidBlock.java -index 5968a30d21367b882501bbb70029b9e0069cca9f..6fee4284d61afa39685bbcd2c6e72a41c5b1cc50 100644 +index 4449addb934033776558e5c549c66da9551201fc..5a26411c8b5927ca2960830ad29a4aa9954704e8 100644 --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java -@@ -202,7 +202,14 @@ public class LiquidBlock extends Block implements BucketPickup { +@@ -204,7 +204,14 @@ public class LiquidBlock extends Block implements BucketPickup { // Sakura start - configure server mechanics final FluidState fluidState = state.getFluidState(); final Block block = fluidState.isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; @@ -25,49 +25,49 @@ index 5968a30d21367b882501bbb70029b9e0069cca9f..6fee4284d61afa39685bbcd2c6e72a41 return true; } diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java -index f7209a487a48e434fde91daa39466de16ead03f2..5edf09ff8aca309882b635706354be1dcec12764 100644 +index f383c6b8f1aefb66fc4a0c54c895a700e7c62f62..790dc2a5c94ab7c54b8b95c5a2c9742604395c1e 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java @@ -185,9 +185,16 @@ public abstract class LavaFluid extends FlowingFluid { @Override - public boolean canBeReplacedWith(FluidState fluidState, BlockGetter blockReader, BlockPos pos, Fluid fluid, Direction direction) { + public boolean canBeReplacedWith(FluidState fluidState, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction) { - // Sakura start - configure server mechanics -- if (blockReader instanceof Level level && level.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13)) { +- if (level instanceof ServerLevel serverLevel && serverLevel.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13)) { - return false; + // Sakura start - configure server mechanics & legacy lava block formation -+ if (blockReader instanceof Level level) { -+ if (level.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13)) { ++ if (level instanceof ServerLevel serverLevel) { ++ if (serverLevel.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13)) { + return false; + } + -+ if (level.sakuraConfig().environment.blockGeneration.legacyBlockFormation) { ++ if (serverLevel.sakuraConfig().environment.blockGeneration.legacyBlockFormation) { + return false; + } + // Sakura end - legacy lava block formation } // Sakura end - configure server mechanics - return fluidState.getHeight(blockReader, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); + return fluidState.getHeight(level, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java -index 62b90ee5c3ecdd82e0fbb7a7812cd59e8cbde567..079bc5b40b0ebbb9b950c06adff6d4b08c5bf309 100644 +index 82b7e176e61e71006be8632c42daae64d89cf11c..5d533125e8eeaa944fada7ff1ac1fa0a45581d55 100644 --- a/net/minecraft/world/level/material/WaterFluid.java +++ b/net/minecraft/world/level/material/WaterFluid.java @@ -124,10 +124,18 @@ public abstract class WaterFluid extends FlowingFluid { @Override - public boolean canBeReplacedWith(FluidState fluidState, BlockGetter blockReader, BlockPos pos, Fluid fluid, Direction direction) { + public boolean canBeReplacedWith(FluidState fluidState, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction) { - // Sakura start - configure server mechanics - final boolean canReplace = direction == Direction.DOWN -- || blockReader instanceof Level level -- && level.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13); +- || level instanceof ServerLevel serverLevel +- && serverLevel.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13); + // Sakura start - configure server mechanics & legacy lava block formation + boolean canReplace = false; + if (direction == Direction.DOWN) { + canReplace = true; -+ } else if (blockReader instanceof Level level) { -+ if (level.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13)) { ++ } else if (level instanceof ServerLevel serverLevel) { ++ if (serverLevel.localConfig().at(pos).mechanicsTarget.before(me.samsuik.sakura.mechanics.MechanicVersion.v1_13)) { + canReplace = true; -+ } else if (level.sakuraConfig().environment.blockGeneration.legacyBlockFormation) { ++ } else if (serverLevel.sakuraConfig().environment.blockGeneration.legacyBlockFormation) { + canReplace = true; + } + } 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 5328baa..99da53d 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,7 +5,7 @@ Subject: [PATCH] Add entity travel distance limits diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 0b9ac2b9e07102babf3c8975cae42841b63f1c63..c94aa1d950a18a29692f9c4e668c8495985ca4c8 100644 +index f6e3cc7659175b29b238f7a0ff12f96d035a7b6a..d68056892cf9f41be819e76535e6cbe553958867 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -1343,6 +1343,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -21,7 +21,7 @@ index 0b9ac2b9e07102babf3c8975cae42841b63f1c63..c94aa1d950a18a29692f9c4e668c8495 } 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 a0e8c5d822c9312054c682d2727d05eb9d885cd5..c5d38a77e28574d54677cd23b690f9ea3994ee63 100644 +index 0ff02180233e72266f6997aa6edb7878881c0ba1..2d54ee2493f03af8fb5cb1a44a2e802742675042 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -603,6 +603,18 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @@ -41,13 +41,13 @@ index a0e8c5d822c9312054c682d2727d05eb9d885cd5..c5d38a77e28574d54677cd23b690f9ea + } + // Sakura end - entity travel distance limits - public Entity(EntityType entityType, Level level) { - this.type = entityType; + public Entity(EntityType type, Level level) { + this.type = type; @@ -632,6 +644,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name 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 -+ this.travelDistanceLimit = level == null ? Integer.MAX_VALUE : Math.pow(level.sakuraConfig().entity.chunkTravelLimit.getOrDefault(entityType, Integer.MAX_VALUE) * 16.0, 2); // Sakura - entity travel distance limits ++ this.travelDistanceLimit = level == null ? Integer.MAX_VALUE : Math.pow(level.sakuraConfig().entity.chunkTravelLimit.getOrDefault(type, Integer.MAX_VALUE) * 16.0, 2); // Sakura - entity travel distance limits } public boolean isColliding(BlockPos pos, BlockState state) { 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 925fa47..70e4bd5 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,7 +5,7 @@ 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 c5d38a77e28574d54677cd23b690f9ea3994ee63..679a377f068ce4f37b2a3e6f446cccc51fb29bf9 100644 +index 2d54ee2493f03af8fb5cb1a44a2e802742675042..805d7dbc497e4763c0017fc2031ec9e1b8524d89 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -615,6 +615,47 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name @@ -54,8 +54,8 @@ index c5d38a77e28574d54677cd23b690f9ea3994ee63..679a377f068ce4f37b2a3e6f446cccc5 + } + // Sakura end - configurable left shooting and adjusting limits - public Entity(EntityType entityType, Level level) { - this.type = entityType; + public Entity(EntityType type, Level level) { + this.type = type; @@ -1655,6 +1696,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } @@ -77,7 +77,7 @@ index c5d38a77e28574d54677cd23b690f9ea3994ee63..679a377f068ce4f37b2a3e6f446cccc5 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 02dc6c5965354047fc05ad3d3293c7f6277f50cd..1dc2976daac6e0621a3cf573d7e1e673ba5934a3 100644 +index 46d7f001d299ed6bb7987fe3c06c9cd1651bda80..802e890e743e85be9cc28798b12ba0e61ccabcc5 100644 --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -269,6 +269,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti diff --git a/sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch b/sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch index 5a41db0..b4b2868 100644 --- a/sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch +++ b/sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch @@ -33,7 +33,7 @@ index ff747a1ecdf3c888bca0d69de4f85dcd810b6139..d90f6aa4557b5863eba6a206226f763c } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index c94aa1d950a18a29692f9c4e668c8495985ca4c8..0ee3033ef6533dd3ca7ec4b2ba48cfb85a03f596 100644 +index d68056892cf9f41be819e76535e6cbe553958867..c00d922188a11a90902bb51cd73977855c3fb6ca 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java @@ -718,6 +718,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -45,7 +45,7 @@ index c94aa1d950a18a29692f9c4e668c8495985ca4c8..0ee3033ef6533dd3ca7ec4b2ba48cfb8 // Paper start diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 7aa5ffc32835fab4a91db464d9112785475a67e9..a760757da12210b315baad6c3a3d6f52450e78b2 100644 +index 89e89f79a56098c5bcf33dea874fcf0234a071e8..859986b30af1ed33ebebfa99bef168b3bccb60e9 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -836,6 +836,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -57,7 +57,7 @@ index 7aa5ffc32835fab4a91db464d9112785475a67e9..a760757da12210b315baad6c3a3d6f52 protected Level( WritableLevelData levelData, diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index ce27dfb14974d452f50c191a3eeec65d3deff6a3..8a53126b192dca8ee86b47a50da8273df58f31f0 100644 +index 9720c55536d09377d1fbcbf1af4acb3caa9952f2..e69c17a02c88b5206b211ef6421f291657768a25 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -306,6 +306,12 @@ public class RedStoneWireBlock extends Block { @@ -95,20 +95,20 @@ index ce27dfb14974d452f50c191a3eeec65d3deff6a3..8a53126b192dca8ee86b47a50da8273d return 0; } else { - return side != Direction.UP -- && !this.getConnectionState(blockAccess, blockState, pos).getValue(PROPERTY_BY_DIRECTION.get(side.getOpposite())).isConnected() +- && !this.getConnectionState(level, state, pos).getValue(PROPERTY_BY_DIRECTION.get(side.getOpposite())).isConnected() + // Sakura start - cache vanilla and eigencraft wires + if (side == Direction.UP) { + return powerValue; + } -+ final boolean updating = blockAccess instanceof Level level && level.redstoneWireCache.isUpdatingRedstoneWire(pos); -+ final BlockState state = updating ? blockState : this.getConnectionState(blockAccess, blockState, pos); -+ return !state.getValue(PROPERTY_BY_DIRECTION.get(side.getOpposite())).isConnected() ++ final boolean updating = level instanceof ServerLevel serverLevel && serverLevel.redstoneWireCache.isUpdatingRedstoneWire(pos); ++ final BlockState connectionState = updating ? state : this.getConnectionState(level, state, pos); ++ return !connectionState.getValue(PROPERTY_BY_DIRECTION.get(side.getOpposite())).isConnected() + // Sakura end - cache vanilla and eigencraft wires ? 0 : powerValue; } diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index 1867661f9790246ca5ced9ba9c8a3f3ed75ed361..6d4032ead7ee32c71f000261b1440fd3255f78e7 100644 +index f7cebfc66e65ae4e247d60eb7291309a3454184d..a0d7fefaea33a2eb599bc162b26dd89df053a7dd 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -524,6 +524,13 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -134,7 +134,7 @@ index 1867661f9790246ca5ced9ba9c8a3f3ed75ed361..6d4032ead7ee32c71f000261b1440fd3 public Block getBlock() { diff --git a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java -index 879be2d05ef0fcfb8fab0c9f4e5bf66d7fce730b..c995827a4adad2279e98ede5e977aa2775349eec 100644 +index 5d17213a692016d2f005c7820bf2cf1f42ce411f..6e0a41bd6c171b37476cedb57d6dcbdbabd2532f 100644 --- a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java +++ b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java @@ -29,6 +29,13 @@ public class CollectingNeighborUpdater implements NeighborUpdater { @@ -187,7 +187,7 @@ index abcc144a086a45bf4cfa4d1a33e2ae10952e0da2..5cd635ca6c215dde0fd979dd7dbaa9ed } } diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java -index 332b33a004ab11150cca0cc2cefc26d0286648f5..3691a8b2306ad4fb555ea3b4cefb8e1ea0c14b6b 100644 +index 3f4b17a222fdbf97ca8979a43f1f231d9e9d8ddb..42705f342c3594d4a327eb2aa169ee59cd87f13d 100644 --- a/net/minecraft/world/level/redstone/NeighborUpdater.java +++ b/net/minecraft/world/level/redstone/NeighborUpdater.java @@ -17,6 +17,12 @@ import net.minecraft.world.level.block.state.BlockState; @@ -200,6 +200,6 @@ index 332b33a004ab11150cca0cc2cefc26d0286648f5..3691a8b2306ad4fb555ea3b4cefb8e1e + } + // Sakura end - cache vanilla and eigencraft wires + - void shapeUpdate(Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int flags, int recursionLevel); + void shapeUpdate(Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int flags, int recursionLeft); void neighborChanged(BlockPos pos, Block neighborBlock, @Nullable Orientation orientation); 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 45a7e07..d0b6843 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 @@ -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 -@@ -362,6 +_,17 @@ +@@ -392,6 +_,17 @@ thread.start(); return minecraftServer; } @@ -26,7 +26,7 @@ // Paper start - rewrite chunk system private volatile Throwable chunkSystemCrash; -@@ -528,6 +_,10 @@ +@@ -558,6 +_,10 @@ Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); // CraftBukkit end this.paperConfigurations = services.paper().configurations(); // Paper - add paper configuration files @@ -37,19 +37,19 @@ } private void readScoreboard(DimensionDataStorage dataStorage) { -@@ -1293,6 +_,11 @@ +@@ -1325,6 +_,11 @@ this.currentTickStart = tickStart; ++MinecraftServer.currentTick; + // Sakura start - track tick information + if (MinecraftServer.currentTick % 20 == 0) { -+ this.tickInformationCollector.levelData(this.levels.values(), getTPS(this.tickTimes1s, tickStart, l)); ++ this.tickInformationCollector.levelData(this.levels.values(), getTPS(this.tickTimes1s, this.tickRateManager.nanosecondsPerTick())); + } + // Sakura end - track tick information // Paper end - improve tick loop boolean flag = l == 0L; -@@ -1319,6 +_,7 @@ +@@ -1351,6 +_,7 @@ this.tickFrame.end(); this.recordEndOfTick(); // Paper - improve tick loop 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 9f50752..d846e4f 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 @@ -4,8 +4,8 @@ org.bukkit.generator.BiomeProvider biomeProvider // CraftBukkit ) { // CraftBukkit start -- super(levelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(storageSource.levelDirectory.path(), levelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), levelData.getGameRules())), dispatcher); // Paper - create paper world configsAsync-Anti-Xray: Pass executor -+ super(levelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(storageSource.levelDirectory.path(), levelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), levelData.getGameRules())), () -> server.sakuraConfigurations.createWorldConfig(me.samsuik.sakura.configuration.SakuraConfigurations.createWorldContextMap(storageSource.levelDirectory.path(), levelData.getLevelName(), dimension.location(), server.registryAccess())), dispatcher); // Sakura - sakura configuration files // Paper - create paper world configs; Async-Anti-Xray: Pass executor - this.levelStorageAccess = storageSource; +- super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), dispatcher); // Paper - create paper world configs & Async-Anti-Xray: Pass executor ++ super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), () -> server.sakuraConfigurations.createWorldConfig(me.samsuik.sakura.configuration.SakuraConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), server.registryAccess())), dispatcher); // Sakura - sakura configuration files // Paper - create paper world configs & Async-Anti-Xray: Pass executor + this.levelStorageAccess = levelStorageAccess; this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getOrCreate(levelStorageAccess.levelDirectory.path().toFile()); this.levelLoadListener = new net.minecraft.server.level.progress.LoggingLevelLoadListener(false, this); 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 4f4e10b..6d45ee5 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 @@ -6,9 +6,9 @@ // Paper end - optimise entity tracker + public boolean pushedByFluid = true; // Sakura - entity pushed by fluid api - public Entity(EntityType entityType, Level level) { - this.type = entityType; -@@ -4306,7 +_,7 @@ + public Entity(EntityType type, Level level) { + this.type = type; +@@ -4305,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 23027ca..f5a9f9b 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 @@ -41,8 +41,8 @@ + } + // Sakura end - legacy combat mechanics - protected LivingEntity(EntityType entityType, Level level) { - super(entityType, level); + protected LivingEntity(EntityType type, Level level) { + super(type, level); @@ -1520,7 +_,7 @@ } // Paper end - Check distance in entity interactions @@ -86,7 +86,7 @@ } private boolean checkTotemDeathProtection(DamageSource damageSource) { -@@ -1872,6 +_,12 @@ +@@ -1878,6 +_,12 @@ // Paper start if (this.dead) { // Paper @@ -99,7 +99,7 @@ this.level().broadcastEntityEvent(this, (byte)3); this.setPose(Pose.DYING); -@@ -2069,7 +_,7 @@ +@@ -2075,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 @@ -108,7 +108,7 @@ if (true || !(strength <= 0.0)) { // CraftBukkit - Call event even when force is 0 // this.hasImpulse = true; // CraftBukkit - Move down Vec3 deltaMovement = this.getDeltaMovement(); -@@ -2080,10 +_,18 @@ +@@ -2086,10 +_,18 @@ } Vec3 vec3 = new Vec3(x, 0.0, z).normalize().scale(strength); @@ -128,7 +128,7 @@ deltaMovement.z / 2.0 - vec3.z ); Vec3 diff = finalVelocity.subtract(deltaMovement); -@@ -2228,8 +_,14 @@ +@@ -2234,8 +_,14 @@ } } @@ -144,7 +144,7 @@ return 0; } else { double d = this.calculateFallPower(fallDistance); -@@ -2287,9 +_,21 @@ +@@ -2293,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 @@ -166,7 +166,7 @@ } return damageAmount; -@@ -2469,6 +_,12 @@ +@@ -2475,6 +_,12 @@ armorDamage += (float) event.getDamage(DamageModifier.BLOCKING); armorDamage += (float) event.getDamage(DamageModifier.FREEZING); armorDamage += (float) event.getDamage(DamageModifier.HARD_HAT); @@ -179,7 +179,7 @@ this.hurtArmor(damageSource, armorDamage); } -@@ -3415,6 +_,11 @@ +@@ -3421,6 +_,11 @@ if (this.level() instanceof ServerLevel serverLevel) { EnchantmentHelper.runLocationChangedEffects(serverLevel, itemBySlot, this, equipmentSlot1); } @@ -191,7 +191,7 @@ } } -@@ -3615,7 +_,7 @@ +@@ -3621,7 +_,7 @@ } } // Paper end - Add EntityMoveEvent @@ -200,7 +200,7 @@ this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F); } } -@@ -4199,6 +_,13 @@ +@@ -4205,6 +_,13 @@ if (!this.isUsingItem()) { return null; } else { 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 a33d8b9..563adde 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 @@ -6,8 +6,8 @@ public boolean autoExpire = true; // Paper - Expand FallingBlock API + public boolean heightParity; // Sakura - falling block height parity api - public FallingBlockEntity(EntityType entityType, Level level) { - super(entityType, level); + public FallingBlockEntity(EntityType type, Level level) { + super(type, 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 } @@ -37,7 +37,7 @@ + } + // Sakura end - falling block stacking restrictions + - public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState blockState) { + public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState state) { FallingBlockEntity fallingBlockEntity = new FallingBlockEntity( level, @@ -168,7 +_,7 @@ 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 79341d1..16a0932 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,7 +1,7 @@ --- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java +++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java @@ -39,6 +_,25 @@ - super(entityType, x, y, z, level, item); + super(type, x, y, z, level, item); } + // Sakura start - configure potion mechanics diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch index 759e513..03b58d5 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/Projectile.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/projectile/Projectile.java +++ b/net/minecraft/world/entity/projectile/Projectile.java @@ -51,6 +_,12 @@ - super(entityType, level); + super(type, level); } + // Sakura start - configure potion mechanics diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch index 9fb1415..687d3b7 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch @@ -5,15 +5,15 @@ } - HitResult entityHitResult = getEntityHitResult( -- level, projectile, pos, vec3, projectile.getBoundingBox().expandTowards(deltaMovement).inflate(1.0), filter, margin +- level, source, pos, vec3, source.getBoundingBox().expandTowards(deltaMovement).inflate(1.0), filter, margin - ); + // Sakura start - configure potion mechanics -+ final AABB movementAABB = projectile.getBoundingBox().expandTowards(deltaMovement).inflate(1.0); ++ final AABB movementAABB = source.getBoundingBox().expandTowards(deltaMovement).inflate(1.0); + final HitResult entityHitResult; -+ if (level.sakuraConfig().entity.thrownPotion.allowBreakingInsideEntities && projectile instanceof AbstractThrownPotion) { -+ entityHitResult = getEntityHitResult(projectile, pos, vec3, movementAABB, filter, margin); ++ if (level.sakuraConfig().entity.thrownPotion.allowBreakingInsideEntities && source instanceof AbstractThrownPotion) { ++ entityHitResult = getEntityHitResult(source, pos, vec3, movementAABB, filter, margin); + } else { -+ entityHitResult = getEntityHitResult(level, projectile, pos, vec3, movementAABB, filter, margin); ++ entityHitResult = getEntityHitResult(level, source, pos, vec3, movementAABB, filter, margin); + } + // Sakura end - configure potion mechanics if (entityHitResult != null) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/SpawnEggItem.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/SpawnEggItem.java.patch index a7a0115..484d908 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/SpawnEggItem.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/SpawnEggItem.java.patch @@ -18,6 +18,6 @@ + } + // Sakura end - prevent placing spawn eggs inside blocks + - if (type.spawn((ServerLevel)level, stack, source, pos, EntitySpawnReason.SPAWN_ITEM_USE, shouldOffsetY, shouldOffsetYMore) != null) { - stack.consume(1, source); - level.gameEvent(source, GameEvent.ENTITY_PLACE, pos); + if (type.spawn((ServerLevel)level, stack, owner, pos, EntitySpawnReason.SPAWN_ITEM_USE, shouldOffsetY, shouldOffsetYMore) != null) { + stack.consume(1, owner); + level.gameEvent(owner, GameEvent.ENTITY_PLACE, pos); 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 7806f80..5793d09 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 @@ -19,28 +19,28 @@ this.getOrCreateNextSpawnData(level, random, pos).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(type).toString()); this.spawnPotentials = WeightedList.of(); // CraftBukkit - SPIGOT-3496, MC-92282 @@ -90,7 +_,7 @@ - tickDelay = serverLevel.paperConfig().tickRates.mobSpawner; + tickDelay = level.paperConfig().tickRates.mobSpawner; if (tickDelay == -1) { return; } // If disabled // Paper end - Configurable mob spawner tick rate -- if (this.isNearPlayer(serverLevel, pos) && serverLevel.getServer().isSpawnerBlockEnabled()) { -+ if (!serverLevel.sakuraConfig().environment.mobSpawner.requireNearbyPlayer || this.isNearPlayer(serverLevel, pos)) { // Sakura - configure mob spawner behaviour +- if (this.isNearPlayer(level, pos) && level.getServer().isSpawnerBlockEnabled()) { ++ if (!level.sakuraConfig().environment.mobSpawner.requireNearbyPlayer || this.isNearPlayer(level, pos)) { // Sakura - configure mob spawner behaviour if (this.spawnDelay < -tickDelay) { // Paper - Configurable mob spawner tick rate - this.delay(serverLevel, pos); + this.delay(level, pos); } @@ -130,7 +_,7 @@ - if (!customSpawnRules.isValidPosition(blockPos, serverLevel)) { + if (!customSpawnRules.isValidPosition(blockPos, level)) { 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() - )) { +- } else if (!SpawnPlacements.checkSpawnRules(optional.get(), level, EntitySpawnReason.SPAWNER, blockPos, level.getRandom())) { ++ } else if (level.sakuraConfig().environment.mobSpawner.checkSpawnConditions && !SpawnPlacements.checkSpawnRules(optional.get(), level, EntitySpawnReason.SPAWNER, pos, level.getRandom())) { // Sakura - configure mob spawner behaviour continue; -@@ -160,12 +_,19 @@ + } + +@@ -158,12 +_,19 @@ return; } -- int size = serverLevel.getEntities( +- int size = level.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 @@ -48,10 +48,10 @@ - .size(); + // Sakura start - configure mob spawner behaviour + final int size; -+ if (serverLevel.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) { ++ if (level.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) { + size = 0; + } else { -+ size = serverLevel.getEntities( ++ size = level.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 @@ -60,18 +60,18 @@ + } + // Sakura end - configure mob spawner behaviour if (size >= this.maxNearbyEntities) { - this.delay(serverLevel, pos); + this.delay(level, pos); return; -@@ -174,8 +_,11 @@ +@@ -172,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)) { +- if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(level, EntitySpawnReason.SPAWNER) +- || !mob.checkSpawnObstruction(level)) { + // Sakura start - configure mob spawner behaviour -+ if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions && -+ (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) -+ || !mob.checkSpawnObstruction(serverLevel))) { ++ if (level.sakuraConfig().environment.mobSpawner.checkSpawnConditions && ++ (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(level, EntitySpawnReason.SPAWNER) ++ || !mob.checkSpawnObstruction(level))) { + // Sakura end - configure mob spawner behaviour continue; } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch index 3732781..1262d56 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/world/level/block/BubbleColumnBlock.java @@ -50,6 +_,13 @@ @Override - protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean flag) { + protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean pastEdges) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + // Sakura start - configure bubble columns affecting cannon entities + if (!level.sakuraConfig().cannons.tntAndSandAffectedByBubbleColumns && ( @@ -11,6 +11,6 @@ + return; + } + // Sakura end - configure bubble columns affecting cannon entities - if (flag) { + if (pastEdges) { BlockState blockState = level.getBlockState(pos.above()); - boolean flag1 = blockState.getCollisionShape(level, pos).isEmpty() && blockState.getFluidState().isEmpty(); + boolean flag = blockState.getCollisionShape(level, pos).isEmpty() && blockState.getFluidState().isEmpty(); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/LiquidBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/LiquidBlock.java.patch index eb6d393..92903a4 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/LiquidBlock.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/LiquidBlock.java.patch @@ -1,24 +1,24 @@ --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java -@@ -144,7 +_,7 @@ - } +@@ -145,7 +_,7 @@ + // Paper start - Configurable speed for water flowing over lava public int getFlowSpeed(Level level, BlockPos pos) { - if (net.minecraft.core.registries.BuiltInRegistries.FLUID.wrapAsHolder(this.fluid).is(FluidTags.WATER)) { + if (this.fluid.getTickDelay(level) != level.paperConfig().environment.waterOverLavaFlowSpeed && net.minecraft.core.registries.BuiltInRegistries.FLUID.wrapAsHolder(this.fluid).is(FluidTags.WATER)) { // Sakura - avoid expensive lava search if ( - isLava(level, pos.north(1)) || - isLava(level, pos.south(1)) || -@@ -154,7 +_,7 @@ + isLava(level, pos.north()) || + isLava(level, pos.south()) || +@@ -155,7 +_,7 @@ return level.paperConfig().environment.waterOverLavaFlowSpeed; } } - return this.fluid.getTickDelay(level); + return this.fluid.getTickDelay(level, pos); // Sakura - lava flow speed api } + private static boolean isLava(Level level, BlockPos pos) { - final FluidState fluidState = level.getFluidIfLoaded(pos); -@@ -193,6 +_,11 @@ +@@ -195,6 +_,11 @@ for (Direction direction : POSSIBLE_FLOW_DIRECTIONS) { BlockPos blockPos = pos.relative(direction.getOpposite()); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/WebBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/WebBlock.java.patch index 998cdb6..8e793f3 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/WebBlock.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/WebBlock.java.patch @@ -39,4 +39,4 @@ + // Sakura end - configure players colliding with cobwebs @Override - protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean flag) { + protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean pastEdges) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch index bfd950e..539076b 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -3,17 +3,17 @@ @@ -153,12 +_,12 @@ } - protected void spread(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) { + protected void spread(ServerLevel level, BlockPos pos, BlockState state, FluidState fluidState) { - if (!fluidState.isEmpty()) { + if (!fluidState.isEmpty() && (!level.sakuraConfig().environment.disableFluidsFlowingThroughTheWorldBorder || level.getWorldBorder().isWithinBounds(pos))) { // Sakura - configure fluids flowing through the world border BlockPos blockPos = pos.below(); - BlockState blockState1 = level.getBlockState(blockPos); - FluidState fluidState1 = blockState1.getFluidState(); - if (this.canMaybePassThrough(level, pos, blockState, Direction.DOWN, blockPos, blockState1, fluidState1)) { -- FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState1); -+ FluidState newLiquid = this.getLiquidFromSurroundings(level, blockPos, blockState1, Direction.DOWN); // Sakura - optimise new liquid level + BlockState blockState = level.getBlockState(blockPos); + FluidState fluidState1 = blockState.getFluidState(); + if (this.canMaybePassThrough(level, pos, state, Direction.DOWN, blockPos, blockState, fluidState1)) { +- FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState); ++ FluidState newLiquid = this.getLiquidFromSurroundings(level, blockPos, blockState, Direction.DOWN); // Sakura - optimise new liquid level Fluid type = newLiquid.getType(); - if (fluidState1.canBeReplacedWith(level, blockPos, type, Direction.DOWN) && canHoldSpecificFluid(level, blockPos, blockState1, type)) { + if (fluidState1.canBeReplacedWith(level, blockPos, type, Direction.DOWN) && canHoldSpecificFluid(level, blockPos, blockState, type)) { // CraftBukkit start @@ -200,6 +_,11 @@ BlockPos blockPos = pos.relative(direction); @@ -158,10 +158,10 @@ @@ -478,7 +_,7 @@ @Override - public void tick(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) { + public void tick(ServerLevel level, BlockPos pos, BlockState state, FluidState fluidState) { if (!fluidState.isSource()) { - FluidState newLiquid = this.getNewLiquid(level, pos, level.getBlockState(pos)); -+ FluidState newLiquid = this.getNewLiquid(level, pos, blockState); // Sakura - optimise new liquid level; liquid draining ++ FluidState newLiquid = this.getNewLiquid(level, pos, state); // Sakura - optimise new liquid level; liquid draining int spreadDelay = this.getSpreadDelay(level, pos, fluidState, newLiquid); if (newLiquid.isEmpty()) { fluidState = newLiquid; diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/Fluid.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/Fluid.java.patch index 96feb31..66db690 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/Fluid.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/Fluid.java.patch @@ -10,6 +10,6 @@ + } + // Sakura end - lava flow speed api + - protected abstract Vec3 getFlow(BlockGetter blockReader, BlockPos pos, FluidState fluidState); + protected abstract Vec3 getFlow(BlockGetter level, BlockPos pos, FluidState fluidState); public abstract int getTickDelay(LevelReader level);