Limit TNT Detonations per tick

This gives a per-world control on how much TNT will be processed per-tick,
preventing a massive TNT detonation from lagging out the server.

By: Aikar <aikar@aikar.co>
This commit is contained in:
CraftBukkit/Spigot
2014-08-20 18:12:32 -04:00
parent c34736a0d2
commit d7f3ba3df3
3 changed files with 28 additions and 8 deletions

View File

@ -208,7 +208,7 @@
LevelChunk chunk = this.getChunkAt(pos);
Block block = state.getBlock();
- BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0);
+
+ // CraftBukkit start - capture blockstates
+ boolean captured = false;
+ if (this.captureBlockStates && !this.capturedBlockStates.containsKey(pos)) {
@ -217,7 +217,7 @@
+ captured = true;
+ }
+ // CraftBukkit end
+
+ BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag
+
if (iblockdata1 == null) {
@ -373,13 +373,14 @@
Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
boolean flag = this.tickRateManager().runsNormally();
@@ -459,13 +661,16 @@
@@ -459,13 +661,17 @@
}
}
+ this.timings.tileEntityTick.stopTiming(); // Spigot
this.tickingBlockEntities = false;
gameprofilerfiller.pop();
+ this.spigotConfig.currentPrimedTnt = 0; // Spigot
}
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
@ -390,7 +391,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking entity");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being ticked");
@@ -510,13 +715,29 @@
@@ -510,13 +716,29 @@
@Nullable
@Override
public BlockEntity getBlockEntity(BlockPos pos) {
@ -421,7 +422,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(blockEntity);
}
}
@@ -643,7 +864,7 @@
@@ -643,7 +865,7 @@
for (int k = 0; k < j; ++k) {
EnderDragonPart entitycomplexpart = aentitycomplexpart[k];
@ -430,7 +431,7 @@
if (t0 != null && predicate.test(t0)) {
result.add(t0);
@@ -912,7 +1133,7 @@
@@ -912,7 +1134,7 @@
public static enum ExplosionInteraction implements StringRepresentable {