Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions paper-api/src/main/java/org/bukkit/block/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Collection;
import org.bukkit.Chunk;
import org.bukkit.Fluid;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
import org.bukkit.Material;
Expand Down Expand Up @@ -492,6 +493,15 @@ default int getBlockPower() {
* @return true if block is replaceable
*/
boolean isReplaceable();

/**
* Checks if this block can be immediately replaced by a specific fluid
*
* @param fluid the fluid to be replaceable with
* @return true if the block can be replaced
*/
boolean isFluidReplaceable(@NotNull Fluid fluid);

/**
* Check if this block is solid
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Fluid;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
import org.bukkit.Material;
Expand All @@ -42,6 +43,7 @@
import org.bukkit.block.BlockFace;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftFluid;
import org.bukkit.craftbukkit.CraftFluidCollisionMode;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
Expand Down Expand Up @@ -443,6 +445,12 @@ public boolean isReplaceable() {
return this.getBlockState().canBeReplaced();
}

@Override
public boolean isFluidReplaceable(final Fluid fluid) {
Preconditions.checkArgument(fluid != null, "Fluid cannot be null");
return this.getBlockState().canBeReplaced(CraftFluid.bukkitToMinecraft(fluid));
}

@Override
public boolean isSolid() {
return this.getBlockState().blocksMotion();
Expand Down
Loading