Paper/Spigot-Server-Patches/0316-Fix-SpongeAbsortEvent-handling.patch

39 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 10 Nov 2018 05:15:21 +0000
Subject: [PATCH] Fix SpongeAbsortEvent handling
Only process drops when the block is actually going to be removed
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index bbd2e1be0f401d7e267dcfa2c905f42c2a475dd7..4f9c6b25f152b348a00dadf4b8f58ec3adc3476e 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -197,7 +197,7 @@ public class Block extends BlockBase implements IMaterial {
iblockdata.dropNaturally(world, blockposition, ItemStack.b);
}
-
+ public static void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity) { a(iblockdata, world, blockposition, tileentity); }
public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity) {
if (world instanceof WorldServer) {
a(iblockdata, (WorldServer) world, blockposition, tileentity).forEach((itemstack) -> {
diff --git a/src/main/java/net/minecraft/server/BlockSponge.java b/src/main/java/net/minecraft/server/BlockSponge.java
index e3e4837dab995dba3c509d0e192bbfed5a1b8bc1..362750bd85bc65c304f5fece344ecdeddebaf4ee 100644
--- a/src/main/java/net/minecraft/server/BlockSponge.java
+++ b/src/main/java/net/minecraft/server/BlockSponge.java
@@ -115,8 +115,11 @@ public class BlockSponge extends Block {
// NOP
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? world.getTileEntity(blockposition2) : null;
-
- a(iblockdata, world, blockposition2, tileentity);
+ // Paper start
+ if (block.getHandle().getMaterial() == Material.AIR) {
+ dropNaturally(iblockdata, world, blockposition2, tileentity);
+ }
+ // Paper end
}
}
world.setTypeAndData(blockposition2, block.getHandle(), block.getFlag());