diff --git a/gradle.properties b/gradle.properties index a4d7254..cdcf452 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=me.samsuik.sakura version=1.20.4-R0.1-SNAPSHOT mcVersion=1.20.4 -paperRef=0fadaed0783782877502a24fac53a63753959191 +paperRef=b4c9e7e5d40fd4a0a7fea270fd4ebb72b38fa0fc org.gradle.jvmargs=-Xmx2G diff --git a/patches/server/0001-Branding-changes.patch b/patches/server/0001-Branding-changes.patch index 78af259..2506791 100644 --- a/patches/server/0001-Branding-changes.patch +++ b/patches/server/0001-Branding-changes.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Branding changes From ForkPaper. diff --git a/build.gradle.kts b/build.gradle.kts -index 170a915098f09ace226648da342a04c5c7583d11..b71b33dabf3066e4b098c6de7bdb21222da2e304 100644 +index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..2d57d5611cc5784e07c2e28b30891b75b05dca43 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,8 +27,12 @@ repositories { @@ -47,10 +47,10 @@ index 34f19ac897a30c0c4e3ab406013fcca1c8b7db93..6e1c140d0d26728d64b827f6f3e5a450 public SystemReport fillSystemReport(SystemReport details) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 782bb8ca67517dde5dba8f0a133eb8699353dd01..05afb663ecc4d34b80bd6c66d01cd2677bd75f38 100644 +index e011cfcdda2e0a609d4158b0454bdf046b04c9d9..75198c29643f88ad6f6e94b142eac05f124c5a10 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -270,7 +270,7 @@ import javax.annotation.Nullable; // Paper +@@ -264,7 +264,7 @@ import javax.annotation.Nullable; // Paper import javax.annotation.Nonnull; // Paper public final class CraftServer implements Server { diff --git a/patches/server/0004-Sakura-Configuration-Files.patch b/patches/server/0004-Sakura-Configuration-Files.patch index 62fc065..6d5a62d 100644 --- a/patches/server/0004-Sakura-Configuration-Files.patch +++ b/patches/server/0004-Sakura-Configuration-Files.patch @@ -976,7 +976,7 @@ index 58536aabf607015939a1326f80207c0a06eed8ff..102c5bb9a1702b06ed6418bfe9e41319 this.setPvpAllowed(dedicatedserverproperties.pvp); this.setFlightAllowed(dedicatedserverproperties.allowFlight); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f4d53d9bfe5b060158f69b5d9e4533a5b9869eed..03fcd3d24b18745c3ddbc20edbb06b92417db341 100644 +index b78a9628a88f2a495ef6de74446a02a14d41a1f6..1f36015d2e9c433cfe2de079b8eba144f0dad4cf 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -693,7 +693,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1018,10 +1018,10 @@ index 0b56e5f7f18fc4286992af22d402205b771165a3..be86deb703272d014de14a9789a5c505 this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 05afb663ecc4d34b80bd6c66d01cd2677bd75f38..872a30aa8695eaf8784792c84483c417c89dc867 100644 +index 75198c29643f88ad6f6e94b142eac05f124c5a10..1cd650d96686c34d2d439e3edef3c214306b975b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1036,6 +1036,7 @@ public final class CraftServer implements Server { +@@ -1037,6 +1037,7 @@ public final class CraftServer implements Server { org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); @@ -1029,7 +1029,7 @@ index 05afb663ecc4d34b80bd6c66d01cd2677bd75f38..872a30aa8695eaf8784792c84483c417 for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) -@@ -1066,6 +1067,7 @@ public final class CraftServer implements Server { +@@ -1067,6 +1068,7 @@ public final class CraftServer implements Server { this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper @@ -1038,7 +1038,7 @@ index 05afb663ecc4d34b80bd6c66d01cd2677bd75f38..872a30aa8695eaf8784792c84483c417 this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 4b457cbfc56e55e0ae0fee5b69e2e75349702aab..7f88e9fb060d0f2c6ad94277072805c9bc69fadf 100644 +index a74a8a027c99eef199c1a6a54232ac2c8ffb9d08..0bf24ee26eb96f02918fd82b5967681e3df2ce85 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -174,6 +174,14 @@ public class Main { diff --git a/patches/server/0006-Visibility-API-and-Command.patch b/patches/server/0006-Visibility-API-and-Command.patch index efe029d..f29a7fb 100644 --- a/patches/server/0006-Visibility-API-and-Command.patch +++ b/patches/server/0006-Visibility-API-and-Command.patch @@ -404,7 +404,7 @@ index 1f36015d2e9c433cfe2de079b8eba144f0dad4cf..c33c9cb3a0e574e5284e48ffaf8d0945 } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8efbbd379244e3ed54d4aba199037cc20ccd096a..3ef738c817c10a9233b930296ce5df6e6dc0a58b 100644 +index d1f20a8a3ccea1f074624163eb96da023142a459..29422f36aa5727ae9e8f6728964fda9889986e02 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -261,6 +261,7 @@ public class ServerPlayer extends Player { @@ -561,10 +561,10 @@ index 30ccbab1586a656e0ae41d7406525fb02d9e025b..187ba90c50256aaa0514f4b2bd79bf30 if (this.player.containerMenu != oldContainer) { return; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9abe817ae202edaa2d88cd59ae5c7db0b1c634be..f3b02609297b663559b82984dcd93db186e645f5 100644 +index 0c46a4aeafd03fbbfd590b0362d41bf2b1d5ca74..b2d2b6d588572682730a228888b6dcdae2dc5020 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -536,6 +536,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -535,6 +535,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S this.teleportTo(worldserver, null); } // Paper end - make end portalling safe @@ -611,10 +611,10 @@ index 512088b5457e5afbc29d2937051fc4dcc4c5aed6..8fd4d63fdbff9c454d903f4797ec9281 this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index fd84786f3e72875e79df46416f47f3403876cef3..044033eb34581849ecb0463164ca05bf19466c76 100644 +index 3be5e4df190bff0087c8450b16e4e37b07169040..201a5c5652232cfc64c476d066225df6bb1690d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -497,6 +497,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -494,6 +494,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().displayName = name == null ? this.getName() : name; } diff --git a/patches/server/0008-Reduce-deltaMovement-Allocations.patch b/patches/server/0008-Reduce-deltaMovement-Allocations.patch index 7827cb2..b4d7222 100644 --- a/patches/server/0008-Reduce-deltaMovement-Allocations.patch +++ b/patches/server/0008-Reduce-deltaMovement-Allocations.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce deltaMovement Allocations diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f3b02609297b663559b82984dcd93db186e645f5..8e877437f4d27ef210c9bfbbdbe16e2c328b4e54 100644 +index b2d2b6d588572682730a228888b6dcdae2dc5020..4ffa96f7eeefd6a2a07458f68458cdbf4369340f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1234,7 +1234,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1233,7 +1233,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S this.tryCheckInsideBlocks(); float f = this.getBlockSpeedFactor(); @@ -17,7 +17,7 @@ index f3b02609297b663559b82984dcd93db186e645f5..8e877437f4d27ef210c9bfbbdbe16e2c // Paper start - remove expensive streams from here boolean noneMatch = true; AABB fireSearchBox = this.getBoundingBox().deflate(1.0E-6D); -@@ -2054,6 +2054,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2049,6 +2049,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S public void moveTo(double x, double y, double z, float yaw, float pitch) { // Paper - cancel entity velocity if teleported if (!preserveMotion) { @@ -25,7 +25,7 @@ index f3b02609297b663559b82984dcd93db186e645f5..8e877437f4d27ef210c9bfbbdbe16e2c this.deltaMovement = Vec3.ZERO; } else { this.preserveMotion = false; -@@ -3456,29 +3457,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -3451,29 +3452,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } public void onAboveBubbleCol(boolean drag) { @@ -67,7 +67,7 @@ index f3b02609297b663559b82984dcd93db186e645f5..8e877437f4d27ef210c9bfbbdbe16e2c this.resetFallDistance(); } -@@ -4465,16 +4470,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4460,16 +4465,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S vec3d = vec3d.normalize(); } @@ -90,7 +90,7 @@ index f3b02609297b663559b82984dcd93db186e645f5..8e877437f4d27ef210c9bfbbdbe16e2c } this.fluidHeight.put(tag, d1); -@@ -4545,11 +4553,53 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4540,11 +4548,53 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return this.chunkPosition; } @@ -144,7 +144,7 @@ index f3b02609297b663559b82984dcd93db186e645f5..8e877437f4d27ef210c9bfbbdbe16e2c synchronized (this.posLock) { // Paper this.deltaMovement = velocity; } // Paper -@@ -4560,7 +4610,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4555,7 +4605,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } public void setDeltaMovement(double x, double y, double z) { @@ -214,7 +214,7 @@ index 62a3cd512d473d5ed673386d5c15091a09426945..12067c0372ad2803ffa2501a8296496a int i = this.getFuse() - 1; diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 87897b21c422a6301a08b388a69b3cec650bdfb5..9fdfc43ea51a326444a04d79976d315aa64050d1 100644 +index 9cd244090c294927a7a92c920854d2282ea3f021..3d4a75302d72bdbe47d0efbe08c89401dbe22a87 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -619,10 +619,11 @@ public class Explosion { diff --git a/patches/server/0010-Load-Chunks-on-Movement.patch b/patches/server/0010-Load-Chunks-on-Movement.patch index d9ecdd3..0bab475 100644 --- a/patches/server/0010-Load-Chunks-on-Movement.patch +++ b/patches/server/0010-Load-Chunks-on-Movement.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Load Chunks on Movement diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java -index bfb1de19f53d5d7c7b65e25a606fabfa416706b3..ae2eede559bd9fe7e500ce180f2ac102a95d3856 100644 +index ee0331a6bc40cdde08d926fd8eb1dc642630c2e5..57ca8212991d0660dd41b70350f59830d4fd09f3 100644 --- a/src/main/java/io/papermc/paper/util/CollisionUtil.java +++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java -@@ -1595,6 +1595,7 @@ public final class CollisionUtil { +@@ -1569,6 +1569,7 @@ public final class CollisionUtil { public static final int COLLISION_FLAG_COLLIDE_WITH_UNLOADED_CHUNKS = 1 << 1; public static final int COLLISION_FLAG_CHECK_BORDER = 1 << 2; public static final int COLLISION_FLAG_CHECK_ONLY = 1 << 3; @@ -16,7 +16,7 @@ index bfb1de19f53d5d7c7b65e25a606fabfa416706b3..ae2eede559bd9fe7e500ce180f2ac102 public static boolean getCollisionsForBlocksOrWorldBorder(final Level world, final Entity entity, final AABB aabb, final List intoVoxel, final List intoAABB, -@@ -1644,11 +1645,20 @@ public final class CollisionUtil { +@@ -1619,11 +1620,20 @@ public final class CollisionUtil { final int maxChunkZ = maxBlockZ >> 4; final boolean loadChunks = (collisionFlags & COLLISION_FLAG_LOAD_CHUNKS) != 0; @@ -50,17 +50,17 @@ index 658e63ebde81dc14c8ab5850fb246dc0aab25dea..f1ff1a67fee37ee7b241ceaa164fa4ee public static TicketType create(String name, Comparator argumentComparator) { return new TicketType<>(name, argumentComparator, 0L); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8e877437f4d27ef210c9bfbbdbe16e2c328b4e54..2336ca9f16d8d570eeeff8cd780fa02c0138be04 100644 +index 4ffa96f7eeefd6a2a07458f68458cdbf4369340f..583f94cd4f517f17909da43f546e8c9e4580d3ad 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -538,6 +538,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -537,6 +537,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S // Paper end - make end portalling safe public boolean isPrimedTNT; // Sakura public boolean isFallingBlock; // Sakura + // Sakura start + protected boolean loadChunks = false; + -+ private int getCollisionFlags() { ++ private int getExtraCollisionFlags() { + int flags = 0; + + if (this.loadChunks) { @@ -73,16 +73,16 @@ index 8e877437f4d27ef210c9bfbbdbe16e2c328b4e54..2336ca9f16d8d570eeeff8cd780fa02c public boolean isLegacyTrackingEntity = false; -@@ -1495,7 +1508,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1494,7 +1507,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S io.papermc.paper.util.CollisionUtil.getCollisions( world, this, collisionBox, potentialCollisionsVoxel, potentialCollisionsBB, -- (0), -+ this.getCollisionFlags(), // Sakura +- io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER, ++ io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), // Sakura null, null ); -@@ -4880,7 +4893,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4875,7 +4888,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @Override public boolean isAlwaysTicking() { diff --git a/patches/server/0013-Slice-Packet-obfuscation-and-reduction.patch b/patches/server/0013-Slice-Packet-obfuscation-and-reduction.patch index 9a4fe4a..f8246ca 100644 --- a/patches/server/0013-Slice-Packet-obfuscation-and-reduction.patch +++ b/patches/server/0013-Slice-Packet-obfuscation-and-reduction.patch @@ -203,10 +203,10 @@ index 83c4639c2bdca4dc4281d9f5eca104af3063bfa5..f7d8aaededd39ce52a9d0105f66fd759 if (this.entity instanceof LivingEntity) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2336ca9f16d8d570eeeff8cd780fa02c0138be04..d81156d33184ea5a58e3c4e71eaef9f4c5990ea0 100644 +index 583f94cd4f517f17909da43f546e8c9e4580d3ad..d69dfd44a9ff3ee6861042fa8f5a64c2031815cd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3400,7 +3400,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -3395,7 +3395,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID); return; } diff --git a/patches/server/0018-Store-Entity-Data-State.patch b/patches/server/0018-Store-Entity-Data-State.patch index f8173a4..52980fd 100644 --- a/patches/server/0018-Store-Entity-Data-State.patch +++ b/patches/server/0018-Store-Entity-Data-State.patch @@ -52,10 +52,10 @@ index 0000000000000000000000000000000000000000..c9f2c5ae57878283e8c8bc3847fe63b9 + +} diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d81156d33184ea5a58e3c4e71eaef9f4c5990ea0..89af45a998dd1884bac8ace525b87be9dd291789 100644 +index d69dfd44a9ff3ee6861042fa8f5a64c2031815cd..70ca40c87c161d96a3661066386f2560d0aeca6d 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -551,6 +551,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -550,6 +550,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return flags; } // Sakura end diff --git a/patches/server/0019-Merge-Cannon-Entities.patch b/patches/server/0019-Merge-Cannon-Entities.patch index 41654d6..1fa5d4e 100644 --- a/patches/server/0019-Merge-Cannon-Entities.patch +++ b/patches/server/0019-Merge-Cannon-Entities.patch @@ -189,10 +189,10 @@ index f48eaebb0f9a10fb77e85619b2d2a4996e461195..a507605a04af7f576548129517029192 this.guardEntityTick(this::tickNonPassenger, entity); gameprofilerfiller.pop(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 89af45a998dd1884bac8ace525b87be9dd291789..6e2defee2a8523d7025a8341b41488192618dd1a 100644 +index 70ca40c87c161d96a3661066386f2560d0aeca6d..ce0f8567f8b3d52b806c2c0ef600852ee192c05b 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -579,6 +579,107 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -578,6 +578,107 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return BlockPos.asLong(v.getBlockX(), v.getBlockY(), v.getBlockZ()); } // Sakura end @@ -300,7 +300,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..6e2defee2a8523d7025a8341b4148819 public boolean isLegacyTrackingEntity = false; -@@ -657,6 +758,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -656,6 +757,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S this.getEntityData().registrationLocked = true; // Spigot this.setPos(0.0D, 0.0D, 0.0D); this.eyeHeight = this.getEyeHeight(net.minecraft.world.entity.Pose.STANDING, this.dimensions); @@ -308,7 +308,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..6e2defee2a8523d7025a8341b4148819 } public boolean isColliding(BlockPos pos, BlockState state) { -@@ -2522,6 +2624,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2517,6 +2619,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S nbttagcompound.putBoolean("Paper.FreezeLock", true); } // Paper end @@ -320,7 +320,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..6e2defee2a8523d7025a8341b4148819 return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); -@@ -2669,6 +2776,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2664,6 +2771,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S freezeLocked = nbt.getBoolean("Paper.FreezeLock"); } // Paper end @@ -332,7 +332,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..6e2defee2a8523d7025a8341b4148819 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); -@@ -4876,6 +4988,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4871,6 +4983,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return; } // Paper end - rewrite chunk system diff --git a/patches/server/0021-Optimise-Fast-Movement.patch b/patches/server/0021-Optimise-Fast-Movement.patch index f801089..eeaabf9 100644 --- a/patches/server/0021-Optimise-Fast-Movement.patch +++ b/patches/server/0021-Optimise-Fast-Movement.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimise Fast Movement diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6e2defee2a8523d7025a8341b41488192618dd1a..8d43914e515bbdd58cbc546101af643e6ba6d018 100644 +index ce0f8567f8b3d52b806c2c0ef600852ee192c05b..8733e11bdfdb355928a332c20ed94bb57c57045f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1217,6 +1217,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1216,6 +1216,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } // Paper end - detailed watchdog information @@ -104,7 +104,7 @@ index 6e2defee2a8523d7025a8341b41488192618dd1a..8d43914e515bbdd58cbc546101af643e public void move(MoverType movementType, Vec3 movement) { // Paper start - detailed watchdog information io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main"); -@@ -1594,6 +1683,99 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1593,6 +1682,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return offsetFactor; } @@ -170,13 +170,9 @@ index 6e2defee2a8523d7025a8341b41488192618dd1a..8d43914e515bbdd58cbc546101af643e + // Copied from the collide method below + io.papermc.paper.util.CollisionUtil.getCollisions( + level, this, collisionBox, voxelList, bbList, -+ this.getCollisionFlags(), // Sakura ++ io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), // Sakura + null, null + ); -+ -+ if (collidingWithWorldBorder = io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(level.getWorldBorder(), collisionBox)) { // Paper - this line *is* correct, ignore the IDE warning about assignments being used as a condition -+ voxelList.add(level.getWorldBorder().getCollisionShape()); -+ } + } + + private double scanX(AABB currBoundingBox, double x, List voxelList, List bbList) { diff --git a/patches/server/0023-isPushedByFluid-API.patch b/patches/server/0023-isPushedByFluid-API.patch index 85e8fb6..9e377c5 100644 --- a/patches/server/0023-isPushedByFluid-API.patch +++ b/patches/server/0023-isPushedByFluid-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] isPushedByFluid API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8d43914e515bbdd58cbc546101af643e6ba6d018..b6254947092f15b039d2af442ac36274920731a1 100644 +index 8733e11bdfdb355928a332c20ed94bb57c57045f..8ff5e03e35cea60a53711d058f103e3b8569c170 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -680,6 +680,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -679,6 +679,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S discard(); } // Sakura end @@ -16,7 +16,7 @@ index 8d43914e515bbdd58cbc546101af643e6ba6d018..b6254947092f15b039d2af442ac36274 public boolean isLegacyTrackingEntity = false; -@@ -4240,7 +4241,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -4231,7 +4232,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } public boolean isPushedByFluid() { @@ -26,10 +26,10 @@ index 8d43914e515bbdd58cbc546101af643e6ba6d018..b6254947092f15b039d2af442ac36274 public static double getViewScale() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index aa4dbf91cf6da329fdcacbde98bb870eb48e8f5c..2732ddfd75ed7cba31ca3def306e68a65e3aaa1e 100644 +index 1727e932ac6b9ca09b5df96f9547ff125114e15a..9ce5bb9f15501a17a13e0d13874ff992d5df8a52 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -555,6 +555,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -200,6 +200,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return this.entity.isInWater(); } diff --git a/patches/server/0026-Optimise-TNT-fluid-state-and-pushing.patch b/patches/server/0026-Optimise-TNT-fluid-state-and-pushing.patch index 339acd2..66b3ac1 100644 --- a/patches/server/0026-Optimise-TNT-fluid-state-and-pushing.patch +++ b/patches/server/0026-Optimise-TNT-fluid-state-and-pushing.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimise TNT fluid state and pushing diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b6254947092f15b039d2af442ac36274920731a1..e5df563f4d3806d72236f302391a69e4b06e6447 100644 +index 8ff5e03e35cea60a53711d058f103e3b8569c170..4c55fe458378f2f376a8c31cec57e4751aa3d290 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2187,7 +2187,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2178,7 +2178,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return this.isInWater() || flag; } diff --git a/patches/server/0033-Falling-Block-Stacking-Restrictions.patch b/patches/server/0033-Falling-Block-Stacking-Restrictions.patch index 2afb559..1502ae7 100644 --- a/patches/server/0033-Falling-Block-Stacking-Restrictions.patch +++ b/patches/server/0033-Falling-Block-Stacking-Restrictions.patch @@ -4,8 +4,21 @@ Date: Thu, 16 Nov 2023 20:53:51 +0000 Subject: [PATCH] Falling Block Stacking Restrictions +diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java +index 376322d8e47e24a76c7162d6379c7f71debd7505..872b874649ff5383af73f6b07dd59fdabea3ffb2 100644 +--- a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java ++++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java +@@ -69,7 +69,7 @@ public class WorldConfiguration extends ConfigurationPart { + public boolean preventAtWorldHeight = false; + + public boolean isFallingBlockInBounds(FallingBlockEntity entity) { +- return (!preventAgainstBorder || !io.papermc.paper.util.CollisionUtil.isAlmostCollidingOnBorder(entity.level().getWorldBorder(), entity.getBoundingBox())) ++ return (!preventAgainstBorder || !io.papermc.paper.util.CollisionUtil.isCollidingWithBorder(entity.level().getWorldBorder(), entity.getBoundingBox().inflate(0.01))) + && (!preventAtWorldHeight || entity.blockPosition().getY() < entity.level().getMaxBuildHeight() - 1); + } + } diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 78fe35df4ef92f56d5ea2e80131fb7f4e71c9bea..bf52aafe542ca735181e461d1f9cbc39b8d88220 100644 +index d7a3d869417983ea3758c2fab2de78c098826b19..6274c005f4f53f3cec0c94b7d40cdb7070b190e0 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -260,7 +260,7 @@ public class FallingBlockEntity extends Entity { diff --git a/patches/server/0040-Configure-cannon-physics-by-version.patch b/patches/server/0040-Configure-cannon-physics-by-version.patch index 0c29fed..85baa1a 100644 --- a/patches/server/0040-Configure-cannon-physics-by-version.patch +++ b/patches/server/0040-Configure-cannon-physics-by-version.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configure cannon physics by version diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java -index ae2eede559bd9fe7e500ce180f2ac102a95d3856..7ced5ae768cbea9ee0a7bab2365fbaef1a37d9bd 100644 +index 57ca8212991d0660dd41b70350f59830d4fd09f3..39085c2a356f575f0ef6acaa3de7d9ff560b5a87 100644 --- a/src/main/java/io/papermc/paper/util/CollisionUtil.java +++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java @@ -1495,6 +1495,14 @@ public final class CollisionUtil { @@ -87,7 +87,7 @@ index b87748ae90863abe8f85dcbdc5a202cb3c9e2037..a291516ec7bdb9d8b840f41ca52e6bba x /= distance; y /= distance; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c62bc7959a 100644 +index 4c55fe458378f2f376a8c31cec57e4751aa3d290..852276d9bedc51c3c8a28b60c85fdb23cf9cf818 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -378,7 +378,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -99,7 +99,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 public boolean isInPowderSnow; public boolean wasInPowderSnow; public boolean wasOnFire; -@@ -681,6 +681,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -680,6 +680,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } // Sakura end public boolean pushedByFluid = true; // Sakura @@ -113,7 +113,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 public boolean isLegacyTrackingEntity = false; -@@ -1163,7 +1170,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1162,7 +1169,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } protected void checkSupportingBlock(boolean onGround, @Nullable Vec3 movement) { @@ -122,7 +122,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 AABB axisalignedbb = this.getBoundingBox(); AABB axisalignedbb1 = new AABB(axisalignedbb.minX, axisalignedbb.minY - 1.0E-6D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); Optional optional = this.level.findSupportingBlock(this, axisalignedbb1); -@@ -1225,7 +1232,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1224,7 +1231,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { @@ -131,7 +131,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 movement = this.limitPistonMovement(movement); if (movement.equals(Vec3.ZERO)) { return; -@@ -1243,10 +1250,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1242,10 +1249,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S Vec3 vec3d1 = this.collideScan(movement); double d0 = vec3d1.lengthSqr(); @@ -144,7 +144,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 BlockHitResult movingobjectpositionblock = this.level().clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)); if (movingobjectpositionblock.getType() != HitResult.Type.MISS) { -@@ -1282,6 +1289,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1281,6 +1288,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S if (this.horizontalCollision) { Vec3 vec3d2 = this.getDeltaMovement(); @@ -157,7 +157,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z); } -@@ -1322,7 +1335,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1321,7 +1334,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { this.wasOnFire = this.isOnFire(); @@ -166,7 +166,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper movement = this.limitPistonMovement(movement); -@@ -1349,8 +1362,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1348,8 +1361,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S Vec3 vec3d1 = this.collide(movement); double d0 = vec3d1.lengthSqr(); @@ -177,7 +177,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 BlockHitResult movingobjectpositionblock = this.level().clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)); if (movingobjectpositionblock.getType() != HitResult.Type.MISS) { -@@ -1386,6 +1399,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1385,6 +1398,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S if (this.horizontalCollision) { Vec3 vec3d2 = this.getDeltaMovement(); @@ -190,7 +190,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z); } -@@ -1709,7 +1728,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1708,7 +1727,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S double y = movement.y; double z = movement.z; @@ -202,7 +202,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 if (y != 0.0) { y = scanY(currBoundingBox, y, voxelList, bbList); -@@ -1833,7 +1855,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1824,7 +1846,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return movement; } @@ -211,7 +211,7 @@ index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c6 if (stepHeight > 0.0 && (onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0)) -@@ -1949,8 +1971,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -1940,8 +1962,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S protected void checkInsideBlocks() { AABB axisalignedbb = this.getBoundingBox(); @@ -455,7 +455,7 @@ index 8ee03ac1c824fd2476339202c073239292ef62a2..5e588332f5916355293553012c73a647 // Paper end } diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 4c570ea162f0dec00960705ef615d6e9f4a210a7..8a2d9f6526b62080c4b35ff856b8125c32983364 100644 +index 5a10afb92fd62f433be9be6751e5222f3666c9f3..d92798d848754bb02f2de9ee91e1342ceb8e150c 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -74,6 +74,7 @@ public class Explosion { diff --git a/patches/server/0046-Treat-all-collidable-blocks-as-full-while-moving-fas.patch b/patches/server/0046-Treat-all-collidable-blocks-as-full-while-moving-fas.patch index 84e1eb1..172a4ca 100644 --- a/patches/server/0046-Treat-all-collidable-blocks-as-full-while-moving-fas.patch +++ b/patches/server/0046-Treat-all-collidable-blocks-as-full-while-moving-fas.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Treat all collidable blocks as full while moving fast diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java -index 7ced5ae768cbea9ee0a7bab2365fbaef1a37d9bd..310ad76abcb263fbb067270f522007457c62c81b 100644 +index 39085c2a356f575f0ef6acaa3de7d9ff560b5a87..7828f8a755343aca24ef81fa5738d19b74a7299b 100644 --- a/src/main/java/io/papermc/paper/util/CollisionUtil.java +++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java -@@ -1607,6 +1607,7 @@ public final class CollisionUtil { +@@ -1581,6 +1581,7 @@ public final class CollisionUtil { public static final int COLLISION_FLAG_CHECK_BORDER = 1 << 2; public static final int COLLISION_FLAG_CHECK_ONLY = 1 << 3; public static final int COLLISION_FLAG_ADD_TICKET = 1 << 4; // Sakura @@ -16,7 +16,7 @@ index 7ced5ae768cbea9ee0a7bab2365fbaef1a37d9bd..310ad76abcb263fbb067270f52200745 public static boolean getCollisionsForBlocksOrWorldBorder(final Level world, final Entity entity, final AABB aabb, final List intoVoxel, final List intoAABB, -@@ -1657,6 +1658,7 @@ public final class CollisionUtil { +@@ -1632,6 +1633,7 @@ public final class CollisionUtil { final boolean loadChunks = (collisionFlags & COLLISION_FLAG_LOAD_CHUNKS) != 0; final boolean addTicket = (collisionFlags & COLLISION_FLAG_ADD_TICKET) != 0; // Sakura @@ -24,7 +24,7 @@ index 7ced5ae768cbea9ee0a7bab2365fbaef1a37d9bd..310ad76abcb263fbb067270f52200745 final ServerChunkCache chunkSource = (ServerChunkCache)world.getChunkSource(); for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) { -@@ -1697,7 +1699,7 @@ public final class CollisionUtil { +@@ -1672,7 +1674,7 @@ public final class CollisionUtil { continue; } @@ -33,7 +33,7 @@ index 7ced5ae768cbea9ee0a7bab2365fbaef1a37d9bd..310ad76abcb263fbb067270f52200745 final int sectionAdjust = !hasSpecial ? 1 : 0; final PalettedContainer blocks = section.states; -@@ -1731,12 +1733,20 @@ public final class CollisionUtil { +@@ -1706,12 +1708,20 @@ public final class CollisionUtil { } if (edgeCount == 0 || ((edgeCount != 1 || blockData.hasLargeCollisionShape()) && (edgeCount != 2 || blockData.getBlock() == Blocks.MOVING_PISTON))) { @@ -59,10 +59,10 @@ index 7ced5ae768cbea9ee0a7bab2365fbaef1a37d9bd..310ad76abcb263fbb067270f52200745 AABB singleAABB = blockCollision.getSingleAABBRepresentation(); if (singleAABB != null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7e00e47fe01b996bf6a2f16dc4998ab8146e0169..750dbb959a0cf91e364ba52fbc69dce20260b1af 100644 +index 852276d9bedc51c3c8a28b60c85fdb23cf9cf818..2588180e543dc8ca2e41c15802b59c9b87df7ee6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -548,6 +548,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -547,6 +547,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S flags |= io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_LOAD_CHUNKS | io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_ADD_TICKET; } diff --git a/patches/server/0048-Fix-paper-world-border-collision.patch b/patches/server/0048-Fix-paper-world-border-collision.patch deleted file mode 100644 index c33a7d9..0000000 --- a/patches/server/0048-Fix-paper-world-border-collision.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samsuik <40902469+Samsuik@users.noreply.github.com> -Date: Wed, 29 Nov 2023 23:36:21 +0000 -Subject: [PATCH] Fix paper world border collision - - -diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java -index 310ad76abcb263fbb067270f522007457c62c81b..1edae701aa293ae61039119421ced42828b9a470 100644 ---- a/src/main/java/io/papermc/paper/util/CollisionUtil.java -+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java -@@ -1555,27 +1555,19 @@ public final class CollisionUtil { - - public static boolean isAlmostCollidingOnBorder(final WorldBorder worldborder, final double boxMinX, final double boxMaxX, - final double boxMinZ, final double boxMaxZ) { -- final double borderMinX = worldborder.getMinX(); // -X -- final double borderMaxX = worldborder.getMaxX(); // +X -+ // Sakura start - this method always returned true -+ final double borderMinX = worldborder.getMinX() + COLLISION_EPSILON; // -X -+ final double borderMaxX = worldborder.getMaxX() - COLLISION_EPSILON; // +X - -- final double borderMinZ = worldborder.getMinZ(); // -Z -- final double borderMaxZ = worldborder.getMaxZ(); // +Z -+ final double borderMinZ = worldborder.getMinZ() + COLLISION_EPSILON; // -Z -+ final double borderMaxZ = worldborder.getMaxZ() - COLLISION_EPSILON; // +Z - - return -- // Not intersecting if we're smaller -- !voxelShapeIntersect( -- boxMinX + COLLISION_EPSILON, Double.NEGATIVE_INFINITY, boxMinZ + COLLISION_EPSILON, -- boxMaxX - COLLISION_EPSILON, Double.POSITIVE_INFINITY, boxMaxZ - COLLISION_EPSILON, -- borderMinX, Double.NEGATIVE_INFINITY, borderMinZ, borderMaxX, Double.POSITIVE_INFINITY, borderMaxZ -- ) -- && -- -- // Are intersecting if we're larger -- voxelShapeIntersect( -- boxMinX - COLLISION_EPSILON, Double.NEGATIVE_INFINITY, boxMinZ - COLLISION_EPSILON, -- boxMaxX + COLLISION_EPSILON, Double.POSITIVE_INFINITY, boxMaxZ + COLLISION_EPSILON, -- borderMinX, Double.NEGATIVE_INFINITY, borderMinZ, borderMaxX, Double.POSITIVE_INFINITY, borderMaxZ -- ); -+ // within the border at present -+ !isCollidingWithBorderEdge(worldborder, boxMinX, boxMaxX, boxMinZ, boxMaxZ) -+ // outside the border if we are larger or the border is shrunk -+ && boxMinX < borderMinX || boxMaxX > borderMaxX || boxMinZ < borderMinZ || boxMaxZ > borderMaxZ; -+ // Sakura end - } - - public static boolean isCollidingWithBorderEdge(final WorldBorder worldborder, final AABB boundingBox) { -@@ -1584,11 +1576,13 @@ public final class CollisionUtil { - - public static boolean isCollidingWithBorderEdge(final WorldBorder worldborder, final double boxMinX, final double boxMaxX, - final double boxMinZ, final double boxMaxZ) { -- final double borderMinX = worldborder.getMinX() + COLLISION_EPSILON; // -X -- final double borderMaxX = worldborder.getMaxX() - COLLISION_EPSILON; // +X -+ // Sakura start - compare against an enlarged border -+ final double borderMinX = worldborder.getMinX() - COLLISION_EPSILON; // -X -+ final double borderMaxX = worldborder.getMaxX() + COLLISION_EPSILON; // +X - -- final double borderMinZ = worldborder.getMinZ() + COLLISION_EPSILON; // -Z -- final double borderMaxZ = worldborder.getMaxZ() - COLLISION_EPSILON; // +Z -+ final double borderMinZ = worldborder.getMinZ() - COLLISION_EPSILON; // -Z -+ final double borderMaxZ = worldborder.getMaxZ() + COLLISION_EPSILON; // +Z -+ // Sakura end - - return boxMinX < borderMinX || boxMaxX > borderMaxX || boxMinZ < borderMinZ || boxMaxZ > borderMaxZ; - } diff --git a/patches/server/0049-Reduce-entity-tracker-player-updates.patch b/patches/server/0048-Reduce-entity-tracker-player-updates.patch similarity index 100% rename from patches/server/0049-Reduce-entity-tracker-player-updates.patch rename to patches/server/0048-Reduce-entity-tracker-player-updates.patch diff --git a/patches/server/0050-Add-option-for-legacy-lava-block-formation.patch b/patches/server/0049-Add-option-for-legacy-lava-block-formation.patch similarity index 100% rename from patches/server/0050-Add-option-for-legacy-lava-block-formation.patch rename to patches/server/0049-Add-option-for-legacy-lava-block-formation.patch diff --git a/patches/server/0051-Configure-mob-spawner-defaults.patch b/patches/server/0050-Configure-mob-spawner-defaults.patch similarity index 100% rename from patches/server/0051-Configure-mob-spawner-defaults.patch rename to patches/server/0050-Configure-mob-spawner-defaults.patch diff --git a/patches/server/0052-Allow-disabling-random-dispenser-item-selection.patch b/patches/server/0051-Allow-disabling-random-dispenser-item-selection.patch similarity index 100% rename from patches/server/0052-Allow-disabling-random-dispenser-item-selection.patch rename to patches/server/0051-Allow-disabling-random-dispenser-item-selection.patch diff --git a/patches/server/0053-Add-instant-mob-death-animation.patch b/patches/server/0052-Add-instant-mob-death-animation.patch similarity index 100% rename from patches/server/0053-Add-instant-mob-death-animation.patch rename to patches/server/0052-Add-instant-mob-death-animation.patch diff --git a/patches/server/0054-Configure-fluids-breaking-redstone.patch b/patches/server/0053-Configure-fluids-breaking-redstone.patch similarity index 100% rename from patches/server/0054-Configure-fluids-breaking-redstone.patch rename to patches/server/0053-Configure-fluids-breaking-redstone.patch diff --git a/patches/server/0055-Option-to-disable-explosions-hurting-players.patch b/patches/server/0054-Option-to-disable-explosions-hurting-players.patch similarity index 100% rename from patches/server/0055-Option-to-disable-explosions-hurting-players.patch rename to patches/server/0054-Option-to-disable-explosions-hurting-players.patch diff --git a/patches/server/0056-Iron-golems-take-fall-damage.patch b/patches/server/0055-Iron-golems-take-fall-damage.patch similarity index 100% rename from patches/server/0056-Iron-golems-take-fall-damage.patch rename to patches/server/0055-Iron-golems-take-fall-damage.patch