geforkt von Mirrors/Paper
Cache BlockState for Blocks
Improve performance for many plugins that call .getState() multiple times for things like signs that have to "build" sign data.
Dieser Commit ist enthalten in:
Ursprung
8d0fbc5c1d
Commit
9a2f82feca
39
Spigot-Server-Patches/0102-Cache-BlockState-for-Blocks.patch
Normale Datei
39
Spigot-Server-Patches/0102-Cache-BlockState-for-Blocks.patch
Normale Datei
@ -0,0 +1,39 @@
|
||||
From c304cf83f25749747d81661cf1fc0e4bbd49919e Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 14 Jan 2016 01:16:30 -0500
|
||||
Subject: [PATCH] Cache BlockState for Blocks
|
||||
|
||||
Improve performance for many plugins that call .getState() multiple
|
||||
times for things like signs that have to "build" sign data.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 03d8afb..adcdb20 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -26,6 +26,7 @@ import org.bukkit.util.BlockVector;
|
||||
|
||||
public class CraftBlock implements Block {
|
||||
private final CraftChunk chunk;
|
||||
+ private BlockState state; // Paper
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
@@ -254,7 +255,15 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
public BlockState getState() {
|
||||
+ if (this.state == null) {
|
||||
+ this.state = getState0();
|
||||
+ }
|
||||
+ return this.state;
|
||||
+ }
|
||||
+ private BlockState getState0() {
|
||||
+ // Paper end
|
||||
Material material = getType();
|
||||
|
||||
switch (material) {
|
||||
--
|
||||
2.7.4
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren