Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
842e040c19
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: 220bc594 #486: Add method to get player's attack cooldown 21853d39 SPIGOT-5681: Increase max plugin channel size 5b972adc Improve build process b55e58d9 Note which custom generator is missing required method CraftBukkit Changes:893ad93b
#650: Add method to get player's attack cooldownef706b06
#655: Added support for the VM tag jansi.passthrough when processing messages sent to a ColouredConsoleSender.e0cfb347
SPIGOT-5689: Fireball.setDirection increases velocity too much94cb030f
SPIGOT-5673: swingHand API does not show to selfb331a055
SPIGOT-5680: isChunkGenerated creates empty region filese1335932
Improve build processa8ec1d60
Add a couple of method null checks to CraftWorldce66f693
Misc checkstyle fixes8bd0e9ab
SPIGOT-5669: Fix Beehive.isSedated Spigot Changes: 2040c4c4 SPIGOT-5677, MC-114796: Fix portals generating outside world border ab8f6b5a Rebuild patches e7dc2f53 Rebuild patches
39 Zeilen
1.6 KiB
Diff
39 Zeilen
1.6 KiB
Diff
From e4e41e06f9557a9f8699f3e46a08e0a120153e71 Mon Sep 17 00:00:00 2001
|
|
From: wea_ondara <wea_ondara@alpenblock.net>
|
|
Date: Thu, 10 Oct 2019 11:29:42 +0200
|
|
Subject: [PATCH] Performance improvement for Chunk.getEntities
|
|
|
|
This patch aims to reduce performance cost used by collecting the
|
|
entities of a chunk. Previously the entitySlices were copied into an
|
|
extra array with List.toArray() with is a costly and unneccessary
|
|
operation. This patch will reduce the load of plugins which for example
|
|
implement custom moblimits and depend on Chunk.getEntities().
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
|
index a53bb7295c..3de9b1c594 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
|
@@ -111,14 +111,14 @@ public class CraftChunk implements Chunk {
|
|
Entity[] entities = new Entity[count];
|
|
|
|
for (int i = 0; i < 16; i++) {
|
|
-
|
|
- for (Object obj : chunk.entitySlices[i].toArray()) {
|
|
- if (!(obj instanceof net.minecraft.server.Entity)) {
|
|
+ // Paper start - speed up (was with chunk.entitySlices[i].toArray() and cast checks which costs a lot of performance if called often)
|
|
+ for (net.minecraft.server.Entity entity : chunk.entitySlices[i]) {
|
|
+ if (entity == null) {
|
|
continue;
|
|
}
|
|
-
|
|
- entities[index++] = ((net.minecraft.server.Entity) obj).getBukkitEntity();
|
|
+ entities[index++] = entity.getBukkitEntity();
|
|
}
|
|
+ // Paper end
|
|
}
|
|
|
|
return entities;
|
|
--
|
|
2.26.2
|
|
|