13
0
geforkt von Mirrors/Paper

SPIGOT-4316: Do even less processing when block placement without physics requested

Dieser Commit ist enthalten in:
md_5 2018-08-27 18:27:59 +10:00
Ursprung f598574711
Commit c2cbdc5ab4
3 geänderte Dateien mit 28 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -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) {

Datei anzeigen

@ -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

Datei anzeigen

@ -157,7 +157,7 @@ public class CraftBlock implements Block {
return world.setTypeAndData(position, blockData, 3);
} else {
IBlockData old = world.getType(position);
boolean success = world.setTypeAndData(position, blockData, 18); // NOTIFY | NO_OBSERVER
boolean success = world.setTypeAndData(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
if (success) {
world.getMinecraftWorld().notify(
position,