mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: dc7b7a160 Fix missing username console death message (#5654) (#5658) c639a52a6 Add basic Datapack API (#5653) (#5653) 99c1d9da6 Updated Upstream (CraftBukkit) (#5652) 2d50c17e2 [CI-SKIP] Add PR rebasing steps (#5634) 2c5f8085e Remove boat interaction event (Fixes #5539) 96ee1fb8f fix WorldSaveEvent not firing with /save-all (#5650) e90e7829e remove unneeded patch (#5641) d875bacc2 Activate warning by default when people are doing silly things (#5642) cb896d471 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5643) ecbf5a38e Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)" 20fc4ab70 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636) 20d8812ea Fix CraftPotionBrewer cache (#5632) Tuinity Changes: 1222573d0 Fix incorrect status dataconverter for pre 1.13 chunks
80 lines
4.3 KiB
Diff
80 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: DoctaEnkoda <bierquejason@gmail.com>
|
|
Date: Tue, 11 May 2021 00:28:13 +0200
|
|
Subject: [PATCH] Optimize collisions
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
index 7cea2a2c7c614e7dc1bb9c0c901c64eb7a1bffa0..52cfaedd376021c9e43a5149ac82427d0bcd6904 100644
|
|
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
|
@@ -678,16 +678,10 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
}
|
|
}
|
|
|
|
- int minBlockX = MathHelper.floor(axisalignedbb.minX - MCUtil.COLLISION_EPSILON) - 1;
|
|
- int maxBlockX = MathHelper.floor(axisalignedbb.maxX + MCUtil.COLLISION_EPSILON) + 1;
|
|
-
|
|
+ // Purpur Start Rebase - Calculate when needed only
|
|
int minBlockY = MathHelper.floor(axisalignedbb.minY - MCUtil.COLLISION_EPSILON) - 1;
|
|
int maxBlockY = MathHelper.floor(axisalignedbb.maxY + MCUtil.COLLISION_EPSILON) + 1;
|
|
|
|
- int minBlockZ = MathHelper.floor(axisalignedbb.minZ - MCUtil.COLLISION_EPSILON) - 1;
|
|
- int maxBlockZ = MathHelper.floor(axisalignedbb.maxZ + MCUtil.COLLISION_EPSILON) + 1;
|
|
-
|
|
-
|
|
BlockPosition.MutableBlockPosition mutablePos = new BlockPosition.MutableBlockPosition();
|
|
net.minecraft.world.phys.shapes.VoxelShapeCollision collisionShape = null;
|
|
|
|
@@ -697,6 +691,13 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
return ret;
|
|
}
|
|
|
|
+ int minBlockX = MathHelper.floor(axisalignedbb.minX - MCUtil.COLLISION_EPSILON) - 1;
|
|
+ int maxBlockX = MathHelper.floor(axisalignedbb.maxX + MCUtil.COLLISION_EPSILON) + 1;
|
|
+
|
|
+ int minBlockZ = MathHelper.floor(axisalignedbb.minZ - MCUtil.COLLISION_EPSILON) - 1;
|
|
+ int maxBlockZ = MathHelper.floor(axisalignedbb.maxZ + MCUtil.COLLISION_EPSILON) + 1;
|
|
+ // Purpur End
|
|
+
|
|
int minYIterate = Math.max(0, minBlockY);
|
|
int maxYIterate = Math.min(255, maxBlockY);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/ChunkCache.java b/src/main/java/net/minecraft/world/level/ChunkCache.java
|
|
index b547eb352f90f68cf36ffb82e43ad7acb1892f6a..456ef170f8885ad42c3c2bd2a54c5bc46bfe30cd 100644
|
|
--- a/src/main/java/net/minecraft/world/level/ChunkCache.java
|
|
+++ b/src/main/java/net/minecraft/world/level/ChunkCache.java
|
|
@@ -60,16 +60,10 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess {
|
|
}
|
|
}
|
|
|
|
- int minBlockX = net.minecraft.util.MathHelper.floor(axisalignedbb.minX - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
|
|
- int maxBlockX = net.minecraft.util.MathHelper.floor(axisalignedbb.maxX + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
|
|
-
|
|
+ // Purpur Rebase - Calculate when needed only
|
|
int minBlockY = net.minecraft.util.MathHelper.floor(axisalignedbb.minY - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
|
|
int maxBlockY = net.minecraft.util.MathHelper.floor(axisalignedbb.maxY + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
|
|
-
|
|
- int minBlockZ = net.minecraft.util.MathHelper.floor(axisalignedbb.minZ - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
|
|
- int maxBlockZ = net.minecraft.util.MathHelper.floor(axisalignedbb.maxZ + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
|
|
-
|
|
-
|
|
+
|
|
BlockPosition.MutableBlockPosition mutablePos = new BlockPosition.MutableBlockPosition();
|
|
net.minecraft.world.phys.shapes.VoxelShapeCollision collisionShape = null;
|
|
|
|
@@ -79,6 +73,13 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess {
|
|
return ret;
|
|
}
|
|
|
|
+ int minBlockX = net.minecraft.util.MathHelper.floor(axisalignedbb.minX - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
|
|
+ int maxBlockX = net.minecraft.util.MathHelper.floor(axisalignedbb.maxX + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
|
|
+
|
|
+ int minBlockZ = net.minecraft.util.MathHelper.floor(axisalignedbb.minZ - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
|
|
+ int maxBlockZ = net.minecraft.util.MathHelper.floor(axisalignedbb.maxZ + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
|
|
+ // Purpur End
|
|
+
|
|
int minYIterate = Math.max(0, minBlockY);
|
|
int maxYIterate = Math.min(255, maxBlockY);
|
|
|