mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
928bcc8d3a
Upstream has released updates that appear 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: 09943450 Update SnakeYAML version 5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc 6f82b381 PR-788: Add getHand() to all relevant events CraftBukkit Changes: aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe 5329dd6fd PR-1107: Add getHand() to all relevant events 93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
31 lines
1.7 KiB
Diff
31 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sat, 6 Apr 2019 10:16:48 -0400
|
|
Subject: [PATCH] Optimize Captured TileEntity Lookup
|
|
|
|
upstream was doing a containsKey/get pattern, and always doing it at that.
|
|
that scenario is only even valid if were in the middle of a block place.
|
|
|
|
Optimize to check if the captured list even has values in it, and also to
|
|
just do a get call since the value can never be null.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 1a474fb88dc1447fb754e8ad936ab6add470359c..cb7e92f2694cefeecebc840959a01e1e1945061a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -845,9 +845,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
@Nullable
|
|
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {
|
|
- if (this.capturedTileEntities.containsKey(blockposition)) {
|
|
- return this.capturedTileEntities.get(blockposition);
|
|
+ // Paper start - Optimize capturedTileEntities lookup
|
|
+ net.minecraft.world.level.block.entity.BlockEntity blockEntity;
|
|
+ if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(blockposition)) != null) {
|
|
+ return blockEntity;
|
|
}
|
|
+ // Paper end
|
|
// CraftBukkit end
|
|
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && !io.papermc.paper.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system
|
|
}
|