diff options
author | Aikar <[email protected]> | 2016-02-13 19:29:59 -0600 |
---|---|---|
committer | Zach Brown <[email protected]> | 2016-02-13 19:41:55 -0600 |
commit | 17e043b0fe43e19e78ff64fbd12cbdae197ba04a (patch) | |
tree | a8c0fa3b23036847e56bd18d2fa1dbcf002d8d7a | |
parent | e1db75896c596b1e23e5b4b9c54235c49028809a (diff) | |
download | Paper-17e043b0fe43e19e78ff64fbd12cbdae197ba04a.tar.gz Paper-17e043b0fe43e19e78ff64fbd12cbdae197ba04a.zip |
Optimize getBlockData
-rw-r--r-- | Spigot-Server-Patches/0088-Optimize-getBlockData.patch | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0088-Optimize-getBlockData.patch b/Spigot-Server-Patches/0088-Optimize-getBlockData.patch new file mode 100644 index 0000000000..7986e5b944 --- /dev/null +++ b/Spigot-Server-Patches/0088-Optimize-getBlockData.patch @@ -0,0 +1,33 @@ +From 114866a0d3665b3f45a5e3e5b95d9ba34ec895fa Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Sat, 13 Feb 2016 19:28:50 -0600 +Subject: [PATCH] Optimize getBlockData + +Hot method, so reduce # of instructions for the method. + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index 7efacfa..c636da3 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -489,7 +489,18 @@ public class Chunk { + } + } + ++ // PaperSpigot start - Optimize getBlockData + public IBlockData getBlockData(final BlockPosition blockposition) { ++ if (blockposition.getY() >= 0 && blockposition.getY() >> 4 < this.sections.length) { ++ ChunkSection chunksection = this.sections[blockposition.getY() >> 4]; ++ if (chunksection != null) { ++ return chunksection.getType(blockposition.getX() & 15, blockposition.getY() & 15, blockposition.getZ() & 15); ++ } ++ } ++ return Blocks.AIR.getBlockData(); ++ } ++ public IBlockData getBlockDataSlow(final BlockPosition blockposition) { ++ // PaperSpigot end + if (this.world.G() == WorldType.DEBUG_ALL_BLOCK_STATES) { + IBlockData iblockdata = null; + +-- +2.7.1 + |