Skip to content

Commit bea85ac

Browse files
committed
feat: expose new block change flag
It appears to be a new flag for supporting structure placement while preventing block entities performing "break" operations.
1 parent ba784ce commit bea85ac

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/main/java/org/spongepowered/api/world/BlockChangeFlag.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
package org.spongepowered.api.world;
2626

2727
import org.spongepowered.api.block.BlockTypes;
28+
import org.spongepowered.api.block.entity.BlockEntity;
29+
import org.spongepowered.api.block.entity.carrier.chest.Chest;
2830

2931
/**
3032
* A flag of sorts that determines whether a block change will perform various
@@ -103,7 +105,7 @@ public interface BlockChangeFlag {
103105
/**
104106
* Gets whether this flag is considering that blocks are being moved
105107
* in the world, much like how pistons will move blocks. This has some
106-
* effect on {@link org.spongepowered.api.block.entity.BlockEntity} creation
108+
* effect on {@link BlockEntity} creation
107109
* reaction or drop delays. The behaviors are dependent on the block in
108110
* particular.
109111
*
@@ -133,6 +135,16 @@ public interface BlockChangeFlag {
133135
*/
134136
boolean ignoreRender();
135137

138+
/**
139+
* Gets whether the block change is during a structure placement, which
140+
* disables certain {@link BlockEntity} behaviors like {@link Chest} dropping
141+
* items during a break. This can take place during the growth of a tree,
142+
* a piston moving, or other similar actions.
143+
*
144+
* @return True if the block change is during a structure placement.
145+
*/
146+
boolean structurePlacement();
147+
136148
/**
137149
* Gets the equivalent {@link BlockChangeFlag} of this flag with all
138150
* other flags while having the desired {@code updateNeighbors}
@@ -185,6 +197,8 @@ public interface BlockChangeFlag {
185197

186198
BlockChangeFlag withForcedReRender(boolean forcedReRender);
187199

200+
BlockChangeFlag withStructurePlacement(boolean structurePlacement);
201+
188202
/**
189203
* Gets the inverted {@link BlockChangeFlag} of this flag.
190204
* Normally, this may cancel out certain interactions, such

0 commit comments

Comments
 (0)