mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 20:21:51 +01:00
2f34301581
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 7361a62e SPIGOT-5641: Add Block.getDrops(ItemStack, Entity) 1dc91b15 Add specific notes about what is not API 2b05ef88 #484: Allow statistics to be accessed for offline players CraftBukkit Changes:f7d6ad53
SPIGOT-5603: Use LootContext#lootingModifier in CraftLootTable5838285d
SPIGOT-5657: BlockPlaceEvent not cancelling for tripwire hooksf325b9be
SPIGOT-5641: Add Block.getDrops(ItemStack, Entity)e25a2272
Fix some formatting in CraftHumanEntity498540e0
Add Merchant slot delegateb2de47d5
SPIGOT-5621: Add missing container types for opening InventoryViewaa3a2f27
#645: Allow statistics to be accessed for offline players2122c0b1
#649: CraftBell should implement Bell
42 lines
2.2 KiB
Diff
42 lines
2.2 KiB
Diff
From f6d2192e47570cffa14bbbdab869f0b5b6b64480 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Thu, 2 Apr 2020 02:37:57 -0400
|
|
Subject: [PATCH] Optimize Collision Chunk lookup and avoid loading far chunks
|
|
|
|
Try to use a faster chunk lookup for collision detection, and only
|
|
fall back to the original for nearby chunks.
|
|
|
|
The collision code takes an AABB and generates a cuboid of checks rather
|
|
than a cylinder, so at high velocity this can generate a lot of chunk checks.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java
|
|
index f851ed11df..d154487294 100644
|
|
--- a/src/main/java/net/minecraft/server/ICollisionAccess.java
|
|
+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java
|
|
@@ -83,15 +83,19 @@ public interface ICollisionAccess extends IBlockAccess {
|
|
}
|
|
|
|
while (cursorposition.a()) {
|
|
- int k1 = cursorposition.b();
|
|
- int l1 = cursorposition.c();
|
|
- int i2 = cursorposition.d();
|
|
+ int k1 = cursorposition.b();int x = k1; // Paper
|
|
+ int l1 = cursorposition.c();int y = l1; // Paper
|
|
+ int i2 = cursorposition.d();int z = i2; // Paper
|
|
int j2 = cursorposition.e();
|
|
|
|
if (j2 != 3) {
|
|
int k2 = k1 >> 4;
|
|
int l2 = i2 >> 4;
|
|
- IBlockAccess iblockaccess = ICollisionAccess.this.c(k2, l2);
|
|
+ // Paper start - ensure we don't load chunks
|
|
+ boolean far = entity != null && MCUtil.distance(entity.locX(), entity.locY(), entity.locZ(), x, y, z) > 32;
|
|
+ IBlockAccess iblockaccess = ICollisionAccess.this instanceof WorldServer ? ((WorldServer) ICollisionAccess.this).getChunkProvider().getChunkAtIfLoadedMainThread(k2, l2) : null;
|
|
+ if (!far && iblockaccess == null) iblockaccess = ICollisionAccess.this.c(k2, l2);
|
|
+ // Paper end
|
|
|
|
if (iblockaccess != null) {
|
|
blockposition_mutableblockposition.d(k1, l1, i2);
|
|
--
|
|
2.25.1
|
|
|