Skip to content

Commit

Permalink
Add BlockChangeFlag#performBlockDestruction
Browse files Browse the repository at this point in the history
  • Loading branch information
aromaa committed Jan 12, 2025
1 parent dc9e552 commit 2b5559f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/org/spongepowered/api/world/BlockChangeFlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package org.spongepowered.api.world;

import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.block.entity.BlockEntity;

/**
* A flag of sorts that determines whether a block change will perform various
Expand Down Expand Up @@ -133,6 +134,17 @@ public interface BlockChangeFlag {
*/
boolean ignoreRender();

/**
* Gets whatever this block change is going to perform natural
* block destruction logic, which can potentially cause other
* side effects like block drops from a {@link BlockEntity}.
* The behaviors are dependent on the block in particular.
*
* @return True if the block change should perform
* natural block destruction logic.
*/
boolean performBlockDestruction();

/**
* Gets the equivalent {@link BlockChangeFlag} of this flag with all
* other flags while having the desired {@code updateNeighbors}
Expand Down Expand Up @@ -185,6 +197,16 @@ public interface BlockChangeFlag {

BlockChangeFlag withForcedReRender(boolean forcedReRender);

/**
* Gets the equivalent {@link BlockChangeFlag} of this flag with all
* other flags while having the desired {@code performBlockDestruction}
* as defined by the parameter.
*
* @param performBlockDestruction Whether to perform block destruction
* @return The relative flag with the desired perform destruction
*/
BlockChangeFlag withPerformBlockDestruction(boolean performBlockDestruction);

/**
* Gets the inverted {@link BlockChangeFlag} of this flag.
* Normally, this may cancel out certain interactions, such
Expand Down

0 comments on commit 2b5559f

Please sign in to comment.