Fix bad method call in EquipmentDispenseItemBehavior

This commit is contained in:
Nassim Jahnke 2024-12-16 11:34:20 +01:00
parent 9bf310baef
commit 520ab93fbf
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 8 additions and 4 deletions

View File

@ -15,7 +15,7 @@ index d310e7489fc4ecede8deef59241444769d87b0a1..f268808cb250e374f2d5652b20eece01
return CompletableFuture.<ChunkAccess>supplyAsync(() -> this.getChunk(x, z, chunkStatus, requireChunk), this.mainThreadProcessor).join();
} else {
+ // Paper start - Perf: Optimise getChunkAt calls for loaded chunks
+ LevelChunk ifLoaded = this.getChunkAtIfLoadedMainThread(x, z);
+ LevelChunk ifLoaded = this.getChunkAtIfCachedImmediately(x, z);
+ if (ifLoaded != null) {
+ return ifLoaded;
+ }
@ -51,7 +51,7 @@ index d310e7489fc4ecede8deef59241444769d87b0a1..f268808cb250e374f2d5652b20eece01
-
- return null;
- }
+ return this.getChunkAtIfLoadedMainThread(chunkX, chunkZ); // Paper - Perf: Optimise getChunkAt calls for loaded chunks
+ return this.getChunkAtIfCachedImmediately(chunkX, chunkZ); // Paper - Perf: Optimise getChunkAt calls for loaded chunks
}
}

View File

@ -1,7 +1,11 @@
--- a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
+++ b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
@@ -17,7 +_,13 @@
return dispenseEquipment(blockSource, item) ? item : super.execute(blockSource, item);
@@ -14,10 +_,16 @@
@Override
protected ItemStack execute(BlockSource blockSource, ItemStack item) {
- return dispenseEquipment(blockSource, item) ? item : super.execute(blockSource, item);
+ return dispenseEquipment(blockSource, item, this) ? item : super.execute(blockSource, item); // Paper - fix possible StackOverflowError
}
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper