mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Apply optimise collision checking in move packet handling patch
This commit is contained in:
parent
fee33bd1e2
commit
1d4d2dc5f9
1 changed files with 4 additions and 6 deletions
|
@ -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
|
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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- 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) {
|
+ private boolean hasNewCollision(final ServerLevel world, final Entity entity, final AABB oldBox, final AABB newBox) {
|
||||||
+ final List<AABB> collisionsBB = new java.util.ArrayList<>();
|
+ final List<AABB> collisionsBB = new java.util.ArrayList<>();
|
||||||
+ final List<VoxelShape> collisionsVoxel = new java.util.ArrayList<>();
|
+ final List<VoxelShape> collisionsVoxel = new java.util.ArrayList<>();
|
||||||
+ io.papermc.paper.util.CollisionUtil.getCollisions(
|
+ ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getCollisions(
|
||||||
+ world, entity, newBox, collisionsVoxel, collisionsBB,
|
+ 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
|
+ null, null
|
||||||
+ );
|
+ );
|
||||||
+
|
+
|
||||||
+ for (int i = 0, len = collisionsBB.size(); i < len; ++i) {
|
+ for (int i = 0, len = collisionsBB.size(); i < len; ++i) {
|
||||||
+ final AABB box = collisionsBB.get(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;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ for (int i = 0, len = collisionsVoxel.size(); i < len; ++i) {
|
+ for (int i = 0, len = collisionsVoxel.size(); i < len; ++i) {
|
||||||
+ final VoxelShape voxel = collisionsVoxel.get(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;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
Loading…
Reference in a new issue