mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
e792da723a
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: 30885166 Update to Minecraft 1.16.4 CraftBukkit Changes: 3af81c71 Update to Minecraft 1.16.4 Spigot Changes: f011ca24 Update to Minecraft 1.16.4 Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
52 lines
3.0 KiB
Diff
52 lines
3.0 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 e31ebda893112b932ee314fc72263fc163ed04ba..cc91266704043b46653bdd512637d001677ddc76 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
@@ -619,21 +619,29 @@ 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, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error
|
|
+ // 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(), (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error
|
|
+ // 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, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::a); // CraftBukkit - decompile error
|
|
+ // 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
|
|
}
|
|
|
|
private boolean a(long i, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> function) {
|