From 1d4d2dc5f93e18255a7282230a4dca73df499175 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 16 Aug 2024 06:56:13 -0700 Subject: [PATCH] Apply optimise collision checking in move packet handling patch --- ...e-collision-checking-in-player-move-packet-ha.patch | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) rename patches/{unapplied => }/server/Optimise-collision-checking-in-player-move-packet-ha.patch (95%) diff --git a/patches/unapplied/server/Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/Optimise-collision-checking-in-player-move-packet-ha.patch similarity index 95% rename from patches/unapplied/server/Optimise-collision-checking-in-player-move-packet-ha.patch rename to patches/server/Optimise-collision-checking-in-player-move-packet-ha.patch index acfb03e4c3..e94e4f377c 100644 --- a/patches/unapplied/server/Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/patches/server/Optimise-collision-checking-in-player-move-packet-ha.patch @@ -5,8 +5,6 @@ Subject: [PATCH] Optimise collision checking in player move packet handling Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision -CHECK ME - diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -142,22 +140,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private boolean hasNewCollision(final ServerLevel world, final Entity entity, final AABB oldBox, final AABB newBox) { + final List collisionsBB = new java.util.ArrayList<>(); + final List collisionsVoxel = new java.util.ArrayList<>(); -+ io.papermc.paper.util.CollisionUtil.getCollisions( ++ ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getCollisions( + world, entity, newBox, collisionsVoxel, collisionsBB, -+ io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_COLLIDE_WITH_UNLOADED_CHUNKS | io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER, ++ ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_COLLIDE_WITH_UNLOADED_CHUNKS | ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER, + null, null + ); + + for (int i = 0, len = collisionsBB.size(); i < len; ++i) { + final AABB box = collisionsBB.get(i); -+ if (!io.papermc.paper.util.CollisionUtil.voxelShapeIntersect(box, oldBox)) { ++ if (!ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.voxelShapeIntersect(box, oldBox)) { + return true; + } + } + + for (int i = 0, len = collisionsVoxel.size(); i < len; ++i) { + final VoxelShape voxel = collisionsVoxel.get(i); -+ if (!io.papermc.paper.util.CollisionUtil.voxelShapeIntersectNoEmpty(voxel, oldBox)) { ++ if (!ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.voxelShapeIntersectNoEmpty(voxel, oldBox)) { + return true; + } + }