diff --git a/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch index 507f2700ac2..32b54af6464 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch @@ -21,7 +21,15 @@ public PrimedTnt(EntityType type, Level world) { super(type, world); -@@ -107,10 +114,13 @@ +@@ -94,6 +101,7 @@ + + @Override + public void tick() { ++ if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot + this.handlePortal(); + this.applyGravity(); + this.move(MoverType.SELF, this.getDeltaMovement()); +@@ -107,10 +115,13 @@ this.setFuse(i); if (i <= 0) { @@ -36,7 +44,7 @@ } else { this.updateInWaterStateAndDoFluidPushing(); if (this.level().isClientSide) { -@@ -121,7 +131,13 @@ +@@ -121,7 +132,13 @@ } private void explode() { diff --git a/paper-server/patches/sources/net/minecraft/world/level/Level.java.patch b/paper-server/patches/sources/net/minecraft/world/level/Level.java.patch index d788f050254..3e32360e324 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/Level.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/Level.java.patch @@ -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 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 void guardEntityTick(Consumer 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 { diff --git a/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java b/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java index 9eb517bd2e3..f0d37fb5bd8 100644 --- a/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -356,4 +356,15 @@ public class SpigotWorldConfig this.sprintMultiplier = (float) this.getDouble( "hunger.sprint-multiplier", 0.1 ); this.otherMultiplier = (float) this.getDouble( "hunger.other-multiplier", 0.0 ); } + + public int currentPrimedTnt = 0; + public int maxTntTicksPerTick; + private void maxTntPerTick() { + if ( SpigotConfig.version < 7 ) + { + this.set( "max-tnt-per-tick", 100 ); + } + this.maxTntTicksPerTick = this.getInt( "max-tnt-per-tick", 100 ); + this.log( "Max TNT Explosions: " + this.maxTntTicksPerTick ); + } }