aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TntBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TntBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TntBlock.java.patch92
1 files changed, 92 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TntBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TntBlock.java.patch
new file mode 100644
index 0000000000..e7df5b1fff
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/TntBlock.java.patch
@@ -0,0 +1,92 @@
+--- a/net/minecraft/world/level/block/TntBlock.java
++++ b/net/minecraft/world/level/block/TntBlock.java
+@@ -25,6 +25,10 @@
+ import net.minecraft.world.level.block.state.properties.BooleanProperty;
+ import net.minecraft.world.level.gameevent.GameEvent;
+ import net.minecraft.world.phys.BlockHitResult;
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.block.TNTPrimeEvent.PrimeCause;
++// CraftBukkit end
+
+ public class TntBlock extends Block {
+
+@@ -43,32 +46,29 @@
+ }
+
+ @Override
+- @Override
+- public void onPlace(BlockState blockstate, Level level, BlockPos blockpos, BlockState blockstate1, boolean flag) {
+- if (!blockstate1.is(blockstate.getBlock())) {
+- if (level.hasNeighborSignal(blockpos)) {
+- explode(level, blockpos);
+- level.removeBlock(blockpos, false);
++ public void onPlace(IBlockData state, Level level, BlockPos pos, IBlockData oldState, boolean isMoving) {
++ if (!oldState.is(state.getBlock())) {
++ if (level.hasNeighborSignal(pos) && CraftEventFactory.callTNTPrimeEvent(level, pos, PrimeCause.REDSTONE, null, null)) { // CraftBukkit - TNTPrimeEvent
++ explode(level, pos);
++ level.removeBlock(pos, false);
+ }
+
+ }
+ }
+
+ @Override
+- @Override
+- public void neighborChanged(BlockState blockstate, Level level, BlockPos blockpos, Block block, BlockPos blockpos1, boolean flag) {
+- if (level.hasNeighborSignal(blockpos)) {
+- explode(level, blockpos);
+- level.removeBlock(blockpos, false);
++ public void neighborChanged(IBlockData state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
++ if (level.hasNeighborSignal(pos) && CraftEventFactory.callTNTPrimeEvent(level, pos, PrimeCause.REDSTONE, null, fromPos)) { // CraftBukkit - TNTPrimeEvent
++ explode(level, pos);
++ level.removeBlock(pos, false);
+ }
+
+ }
+
+ @Override
+- @Override
+- public BlockState playerWillDestroy(Level level, BlockPos blockpos, BlockState blockstate, Player player) {
+- if (!level.isClientSide() && !player.isCreative() && (Boolean) blockstate.getValue(TntBlock.UNSTABLE)) {
+- explode(level, blockpos);
++ public IBlockData playerWillDestroy(Level world, BlockPos blockposition, IBlockData iblockdata, Player entityhuman) {
++ if (!world.isClientSide() && !entityhuman.isCreative() && (Boolean) iblockdata.getValue(TntBlock.UNSTABLE) && CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.BLOCK_BREAK, entityhuman, null)) { // CraftBukkit - TNTPrimeEvent
++ explode(world, blockposition);
+ }
+
+ return super.playerWillDestroy(level, blockpos, blockstate, player);
+@@ -108,8 +106,13 @@
+ if (!itemstack.is(Items.FLINT_AND_STEEL) && !itemstack.is(Items.FIRE_CHARGE)) {
+ return super.use(blockstate, level, blockpos, player, interactionhand, blockhitresult);
+ } else {
+- explode(level, blockpos, player);
+- level.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 11);
++ // CraftBukkit start - TNTPrimeEvent
++ if (!CraftEventFactory.callTNTPrimeEvent(level, pos, PrimeCause.PLAYER, player, null)) {
++ return InteractionResult.CONSUME;
++ }
++ // CraftBukkit end
++ explode(level, pos, player);
++ level.setBlock(pos, Blocks.AIR.defaultBlockState(), 11);
+ Item item = itemstack.getItem();
+
+ if (!player.isCreative()) {
+@@ -134,9 +136,14 @@
+ BlockPos blockpos = blockhitresult.getBlockPos();
+ Entity entity = projectile.getOwner();
+
+- if (projectile.isOnFire() && projectile.mayInteract(level, blockpos)) {
+- explode(level, blockpos, entity instanceof LivingEntity ? (LivingEntity) entity : null);
+- level.removeBlock(blockpos, false);
++ if (projectile.isOnFire() && projectile.mayInteract(level, blockposition)) {
++ // CraftBukkit start
++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(projectile, blockposition, Blocks.AIR.defaultBlockState()) || !CraftEventFactory.callTNTPrimeEvent(level, blockposition, PrimeCause.PROJECTILE, projectile, null)) {
++ return;
++ }
++ // CraftBukkit end
++ explode(level, blockposition, entity instanceof LivingEntity ? (LivingEntity) entity : null);
++ level.removeBlock(blockposition, false);
+ }
+ }
+