Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
ce270e1412
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: b2f1908c SPIGOT-5783: Add helpful info to UnknownDependencyException e4f46260 SPIGOT-2623: Add EntityEquipment methods to get/set ItemStacks by slot. 529a9a69 SPIGOT-5751: Clarify behaviour of block drop-related API methods CraftBukkit Changes:8ea9b138
Remove outdated build delay.ffc2b251
Revert "#675: Fix redirected CommandNodes sometimes not being properly redirected"cb701f6b
#675: Fix redirected CommandNodes sometimes not being properly redirectedc9d7c16b
SPIGOT-2623: Add EntityEquipment methods to get/set ItemStacks by slot.fad2494a
#673: Fix Craftworld#isChunkLoaded8637ec00
SPIGOT-5751: Made breakNaturally and getDrops returns the correct item if no argument is given Spigot Changes: a99063f7 Rebuild patches Fixes #3602
63 Zeilen
3.2 KiB
Diff
63 Zeilen
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Thu, 16 Apr 2020 16:13:59 -0700
|
|
Subject: [PATCH] Optimize ChunkProviderServer's chunk level checking helper
|
|
methods
|
|
|
|
These can be hot functions (i.e entity ticking and block ticking),
|
|
so inline where possible, and avoid the abstraction of the
|
|
Either class.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
index b6146330a55665a0365ff7474f1843766e0c0ce1..695d12e1942018be6a9e8c999ba6071b9f778568 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
@@ -617,27 +617,37 @@ public class ChunkProviderServer extends IChunkProvider {
|
|
|
|
public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER
|
|
@Override public boolean a(Entity entity) {
|
|
- long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4);
|
|
-
|
|
- return this.a(i, PlayerChunk::b);
|
|
+ // Paper start - optimize is ticking ready type functions
|
|
+ // entity ticking
|
|
+ PlayerChunk playerChunk = this.getChunk(MCUtil.getCoordinateKey(entity));
|
|
+ return playerChunk != null && playerChunk.isEntityTickingReady();
|
|
+ // Paper end - optimize is ticking ready type functions
|
|
}
|
|
|
|
public final boolean isEntityTickingChunk(ChunkCoordIntPair chunkcoordintpair) { return this.a(chunkcoordintpair); } // Paper - OBFHELPER
|
|
@Override public boolean a(ChunkCoordIntPair chunkcoordintpair) {
|
|
- return this.a(chunkcoordintpair.pair(), PlayerChunk::b);
|
|
+ // Paper start - optimize is ticking ready type functions
|
|
+ // is entity ticking ready
|
|
+ PlayerChunk playerChunk = this.getChunk(MCUtil.getCoordinateKey(chunkcoordintpair));
|
|
+ return playerChunk != null && playerChunk.isEntityTickingReady();
|
|
+ // Paper end - optimize is ticking ready type functions
|
|
}
|
|
|
|
@Override
|
|
public boolean a(BlockPosition blockposition) {
|
|
- long i = ChunkCoordIntPair.pair(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
|
-
|
|
- return this.a(i, PlayerChunk::a);
|
|
+ // Paper start - optimize is ticking ready type functions
|
|
+ // is ticking ready
|
|
+ PlayerChunk playerChunk = this.getChunk(MCUtil.getCoordinateKey(blockposition));
|
|
+ return playerChunk != null && playerChunk.isTickingReady();
|
|
+ // Paper end - optimize is ticking ready type functions
|
|
}
|
|
|
|
public boolean b(Entity entity) {
|
|
- long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4);
|
|
-
|
|
- return this.a(i, PlayerChunk::c);
|
|
+ // Paper start - optimize is ticking ready type functions
|
|
+ // is full chunk ready
|
|
+ PlayerChunk playerChunk = this.getChunk(MCUtil.getCoordinateKey(entity));
|
|
+ return playerChunk != null && playerChunk.isFullChunkReady();
|
|
+ // Paper end - optimize is ticking ready type functions
|
|
}
|
|
|
|
private boolean a(long i, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> function) {
|