Skip to content

Commit b57d641

Browse files
authored
Expose isReplaceable on BlockData (#13180)
1 parent c710b66 commit b57d641

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

paper-api/src/main/java/org/bukkit/block/Block.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,7 @@ public static int getBlockKeyZ(long packed) {
483483
*/
484484
boolean isBurnable();
485485
/**
486-
* Check if this block is replaceable
487-
* <p>
488-
* Determined by Minecraft, representing a block that is not AIR that you can still place a new block at, such as flowers.
486+
* Checks if this block can be immediately replaced by another block, such as placing a new block in air or tall grass.
489487
* @return true if block is replaceable
490488
*/
491489
boolean isReplaceable();

paper-api/src/main/java/org/bukkit/block/data/BlockData.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,10 @@ default float getDestroySpeed(final @NotNull ItemStack itemStack) {
317317
*/
318318
boolean isRandomlyTicked();
319319
// Paper end - Tick API
320+
321+
/**
322+
* Checks if this block can be immediately replaced by another block, such as placing a new block in air or tall grass.
323+
* @return true if block is replaceable
324+
*/
325+
boolean isReplaceable();
320326
}

paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,4 +792,9 @@ public boolean isRandomlyTicked() {
792792
return this.state.isRandomlyTicking();
793793
}
794794
// Paper end - Block tick API
795+
796+
@Override
797+
public boolean isReplaceable() {
798+
return this.state.canBeReplaced();
799+
}
795800
}

0 commit comments

Comments
 (0)