From 0c9bb9b7ae430765540de6ad5d0f5431c15f1166 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 28 Sep 2018 22:40:04 -0400 Subject: [PATCH] Don't recheck type after setting a block The server does a "Did my update succeed" check after setting a blocks data to a chunk. However, writes can not fail outside of a hard error or a a race condition from multiple threads writing, which is not something that should ever occur on the server. So this check is pointless, as if it did occur, the server would be having data corruption issues anyways. This provides a small boost to all setType calls. --- ...t-recheck-type-after-setting-a-block.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Spigot-Server-Patches/0382-Don-t-recheck-type-after-setting-a-block.patch diff --git a/Spigot-Server-Patches/0382-Don-t-recheck-type-after-setting-a-block.patch b/Spigot-Server-Patches/0382-Don-t-recheck-type-after-setting-a-block.patch new file mode 100644 index 0000000000..9c15809a81 --- /dev/null +++ b/Spigot-Server-Patches/0382-Don-t-recheck-type-after-setting-a-block.patch @@ -0,0 +1,33 @@ +From 588da1da60dac3624336295f970c26987135e8f6 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 28 Sep 2018 22:27:33 -0400 +Subject: [PATCH] Don't recheck type after setting a block + +The server does a "Did my update succeed" check after setting +a blocks data to a chunk. + +However, writes can not fail outside of a hard error or a +a race condition from multiple threads writing, which is +not something that should ever occur on the server. + +So this check is pointless, as if it did occur, the server would +be having data corruption issues anyways. + +This provides a small boost to all setType calls. + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index e4bda70bb9..895eb60854 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -573,7 +573,7 @@ public class Chunk implements IChunkAccess { + this.world.n(blockposition); + } + +- if (chunksection.getType(i, j & 15, k).getBlock() != block) { ++ if (false && chunksection.getType(i, j & 15, k).getBlock() != block) { // Paper - don't need to recheck this - this would only fail due to non main thread writes which are not supported + return null; + } else { + if (flag1) { +-- +2.19.0 +