aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/SpongeBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/SpongeBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/SpongeBlock.java.patch122
1 files changed, 122 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/SpongeBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/SpongeBlock.java.patch
new file mode 100644
index 0000000000..c32faa3473
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/SpongeBlock.java.patch
@@ -0,0 +1,122 @@
+--- a/net/minecraft/world/level/block/SpongeBlock.java
++++ b/net/minecraft/world/level/block/SpongeBlock.java
+@@ -12,6 +12,12 @@
+ import net.minecraft.world.level.block.state.BlockBehaviour;
+ import net.minecraft.world.level.block.state.BlockState;
+ import net.minecraft.world.level.material.FluidState;
++// CraftBukkit start
++import java.util.List;
++import org.bukkit.craftbukkit.block.CraftBlockState;
++import org.bukkit.craftbukkit.util.BlockStateListPopulator;
++import org.bukkit.event.block.SpongeAbsorbEvent;
++// CraftBukkit end
+
+ public class SpongeBlock extends Block {
+ public static final MapCodec<SpongeBlock> CODEC = simpleCodec(SpongeBlock::new);
+@@ -49,18 +57,41 @@
+ }
+
+ private boolean removeWaterBreadthFirstSearch(Level level, BlockPos pos) {
+- return BlockPos.breadthFirstTraversal(
+- pos,
+- 6,
+- 65,
+- (validPos, queueAdder) -> {
+- for (Direction direction : ALL_DIRECTIONS) {
+- queueAdder.accept(validPos.relative(direction));
++ BlockStateListPopulator blockList = new BlockStateListPopulator(level); // CraftBukkit - Use BlockStateListPopulator
++ BlockPos.breadthFirstTraversal(pos, 6, 65, (blockposition1, consumer) -> {
++ Direction[] aenumdirection = SpongeBlock.ALL_DIRECTIONS;
++ int i = aenumdirection.length;
++
++ for (int j = 0; j < i; ++j) {
++ Direction enumdirection = aenumdirection[j];
++
++ consumer.accept(blockposition1.relative(enumdirection));
++ }
++
++ }, (blockposition1) -> {
++ if (blockposition1.equals(pos)) {
++ return true;
++ } else {
++ // CraftBukkit start
++ IBlockData iblockdata = blockList.getBlockState(blockposition1);
++ FluidState fluid = blockList.getFluidState(blockposition1);
++ // CraftBukkit end
++
++ if (!fluid.is(FluidTags.WATER)) {
++ return false;
++ } else {
++ Block block = iblockdata.getBlock();
++
++ if (block instanceof BucketPickup) {
++ BucketPickup ifluidsource = (BucketPickup) block;
++
++ if (!ifluidsource.pickupBlock((Player) null, blockList, blockposition1, iblockdata).isEmpty()) { // CraftBukkit
++ return true;
++ }
+ }
+- },
+- currentPos -> {
+- if (currentPos.equals(pos)) {
+- return true;
++
++ if (iblockdata.getBlock() instanceof LiquidBlock) {
++ blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3); // CraftBukkit
+ } else {
+ BlockState blockState = level.getBlockState(currentPos);
+ FluidState fluidState = level.getFluidState(currentPos);
+@@ -89,9 +96,51 @@
+
+ return true;
+ }
++
++ // CraftBukkit start
++ // TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
++
++ // dropResources(iblockdata, world, blockposition1, tileentity);
++ blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3);
++ // CraftBukkit end
+ }
+ }
+- )
+- > 1;
++ }
++ });
++ // CraftBukkit start
++ List<CraftBlockState> blocks = blockList.getList(); // Is a clone
++ if (!blocks.isEmpty()) {
++ final org.bukkit.block.Block bblock = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
++
++ SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, (List<org.bukkit.block.BlockState>) (List) blocks);
++ level.getCraftServer().getPluginManager().callEvent(event);
++
++ if (event.isCancelled()) {
++ return false;
++ }
++
++ for (CraftBlockState block : blocks) {
++ BlockPos blockposition1 = block.getPosition();
++ IBlockData iblockdata = level.getBlockState(blockposition1);
++ FluidState fluid = level.getFluidState(blockposition1);
++
++ if (fluid.is(FluidTags.WATER)) {
++ if (iblockdata.getBlock() instanceof BucketPickup && !((BucketPickup) iblockdata.getBlock()).pickupBlock((Player) null, blockList, blockposition1, iblockdata).isEmpty()) {
++ // NOP
++ } else if (iblockdata.getBlock() instanceof LiquidBlock) {
++ // NOP
++ } else if (iblockdata.is(Blocks.KELP) || iblockdata.is(Blocks.KELP_PLANT) || iblockdata.is(Blocks.SEAGRASS) || iblockdata.is(Blocks.TALL_SEAGRASS)) {
++ BlockEntity tileentity = iblockdata.hasBlockEntity() ? level.getBlockEntity(blockposition1) : null;
++
++ dropResources(iblockdata, level, blockposition1, tileentity);
++ }
++ }
++ level.setBlock(blockposition1, block.getHandle(), block.getFlag());
++ }
++
++ return true;
++ }
++ return false;
++ // CraftBukkit end
+ }
+ }