CavePVP-Stuff/cSpigot-master/spigot-server-Patches/0056-FallingBlock-and-TNT-entities-collide-with-specific-.patch

46 lines
2.6 KiB
Diff
Raw Permalink Normal View History

2023-05-01 20:59:40 +02:00
From 221b09298323158957a30c0064d87c11446e7de6 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 21 Apr 2015 01:36:02 -0700
Subject: [PATCH] FallingBlock and TNT entities collide with specific blocks
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index ad2f6adcb..51ddb6c50 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1287,7 +1287,15 @@ public abstract class World implements IBlockAccess {
Block block = chunk.getType(x - cx, y, z - cz );
if ( block != null )
{
- block.a( this, x, y, z, axisalignedbb, this.L, entity );
+ // PaperSpigot start - FallingBlocks and TNT collide with specific non-collidable blocks
+ if (entity.world.paperSpigotConfig.fallingBlocksCollideWithSigns && (entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) &&
+ (block instanceof BlockSign || block instanceof BlockFenceGate || block instanceof BlockTorch || block instanceof BlockButtonAbstract || block instanceof BlockLever || block instanceof BlockTripwireHook || block instanceof BlockTripwire)) {
+ AxisAlignedBB aabb = AxisAlignedBB.a(x, y, z, x + 1.0, y + 1.0, z + 1.0);
+ if (axisalignedbb.b(aabb)) this.L.add(aabb);
+ } else {
+ block.a( this, x, y, z, axisalignedbb, this.L, entity );
+ }
+ // PaperSpigot end
}
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 72809cc47..1133f0650 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -245,4 +245,10 @@ public class PaperSpigotWorldConfig
loadUnloadedTNTEntities = getBoolean( "load-chunks.tnt-entities", false );
loadUnloadedFallingBlocks = getBoolean( "load-chunks.falling-blocks", false );
}
+
+ public boolean fallingBlocksCollideWithSigns;
+ private void fallingBlocksCollideWithSigns()
+ {
+ fallingBlocksCollideWithSigns = getBoolean( "falling-blocks-collide-with-signs", false );
+ }
}
--
2.13.3