summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-08-27 18:27:59 +1000
committermd_5 <git@md-5.net>2018-08-27 18:29:28 +1000
commitc2cbdc5ab41fe4f77a5a28f01d8b79098b1bb392 (patch)
tree766d5269ec727bc896cd47ca7e64f78314313222 /nms-patches
parentf5985747113f69decf936726bd609e55611ab465 (diff)
downloadcraftbukkit-c2cbdc5ab41fe4f77a5a28f01d8b79098b1bb392.tar
craftbukkit-c2cbdc5ab41fe4f77a5a28f01d8b79098b1bb392.tar.gz
craftbukkit-c2cbdc5ab41fe4f77a5a28f01d8b79098b1bb392.tar.lz
craftbukkit-c2cbdc5ab41fe4f77a5a28f01d8b79098b1bb392.tar.xz
craftbukkit-c2cbdc5ab41fe4f77a5a28f01d8b79098b1bb392.zip
SPIGOT-4316: Do even less processing when block placement without physics requested
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/Chunk.patch34
-rw-r--r--nms-patches/World.patch3
2 files changed, 27 insertions, 10 deletions
diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch
index 41edc035..321b2b38 100644
--- a/nms-patches/Chunk.patch
+++ b/nms-patches/Chunk.patch
@@ -80,17 +80,33 @@
}
public Set<BlockPosition> t() {
-@@ -473,7 +513,8 @@
+@@ -412,8 +452,15 @@
+ }
+ }
+
++ // CraftBukkit start
+ @Nullable
+ public IBlockData a(BlockPosition blockposition, IBlockData iblockdata, boolean flag) {
++ return this.a(blockposition, iblockdata, flag, true);
++ }
++
++ @Nullable
++ public IBlockData a(BlockPosition blockposition, IBlockData iblockdata, boolean flag, boolean doPlace) {
++ // CraftBukkit end
+ int i = blockposition.getX() & 15;
+ int j = blockposition.getY();
+ int k = blockposition.getZ() & 15;
+@@ -473,7 +520,8 @@
}
}
- if (!this.world.isClientSide) {
+ // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
-+ if (!this.world.isClientSide && (!this.world.captureBlockStates || block instanceof BlockTileEntity)) {
++ if (!this.world.isClientSide && doPlace && (!this.world.captureBlockStates || block instanceof BlockTileEntity)) {
iblockdata.onPlace(this.world, blockposition, iblockdata1);
}
-@@ -653,7 +694,12 @@
+@@ -653,7 +701,12 @@
@Nullable
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@@ -104,7 +120,7 @@
if (tileentity == null) {
if (chunk_enumtileentitystate == Chunk.EnumTileEntityState.IMMEDIATE) {
-@@ -688,6 +734,13 @@
+@@ -688,6 +741,13 @@
tileentity.z();
this.tileEntities.put(blockposition, tileentity);
@@ -118,7 +134,7 @@
}
}
-@@ -720,6 +773,17 @@
+@@ -720,6 +780,17 @@
}));
}
@@ -136,7 +152,7 @@
}
public void removeEntities() {
-@@ -736,9 +800,21 @@
+@@ -736,9 +807,21 @@
int i = aentityslice.length;
for (int j = 0; j < i; ++j) {
@@ -160,7 +176,7 @@
}
}
-@@ -800,8 +876,8 @@
+@@ -800,8 +883,8 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -171,7 +187,7 @@
}
}
}
-@@ -1007,13 +1083,13 @@
+@@ -1007,13 +1090,13 @@
@Nullable
public LongSet b(String s) {
@@ -187,7 +203,7 @@
return new LongOpenHashSet();
})).add(i);
}
-@@ -1061,14 +1137,14 @@
+@@ -1061,14 +1144,14 @@
}
if (this.s instanceof ProtoChunkTickList) {
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index 1e96e170..78569d8c 100644
--- a/nms-patches/World.patch
+++ b/nms-patches/World.patch
@@ -146,6 +146,7 @@
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
Block block = iblockdata.getBlock();
+- IBlockData iblockdata1 = chunk.a(blockposition, iblockdata, (i & 64) != 0);
+
+ // CraftBukkit start - capture blockstates
+ CraftBlockState blockstate = null;
@@ -155,7 +156,7 @@
+ }
+ // CraftBukkit end
+
- IBlockData iblockdata1 = chunk.a(blockposition, iblockdata, (i & 64) != 0);
++ IBlockData iblockdata1 = chunk.a(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag
if (iblockdata1 == null) {
+ // CraftBukkit start - remove blockstate if failed