-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b05a06
commit e65cae0
Showing
7 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
api/src/main/java/org/cloudburstmc/api/block/behavior/BooleanBlockStateBehavior.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.cloudburstmc.api.block.behavior; | ||
|
||
import org.cloudburstmc.api.block.BlockState; | ||
import org.cloudburstmc.api.util.behavior.Behavior; | ||
|
||
public interface BooleanBlockStateBehavior { | ||
|
||
boolean test(Behavior<BooleanBlockStateBehavior.Executor> behavior, BlockState block); | ||
|
||
@FunctionalInterface | ||
interface Executor { | ||
boolean execute(BlockState block); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
api/src/main/java/org/cloudburstmc/api/block/behavior/PlaceBlockBehavior.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.cloudburstmc.api.block.behavior; | ||
|
||
import com.nukkitx.math.vector.Vector3f; | ||
import com.nukkitx.math.vector.Vector3i; | ||
import org.cloudburstmc.api.block.BlockState; | ||
import org.cloudburstmc.api.player.Player; | ||
import org.cloudburstmc.api.util.Direction; | ||
import org.cloudburstmc.api.util.behavior.Behavior; | ||
|
||
public interface PlaceBlockBehavior { | ||
|
||
boolean execute( | ||
Behavior<PlaceBlockBehavior.Executor> behavior, | ||
BlockState blockState, | ||
Player player, | ||
Vector3i blockPosition, | ||
Direction face, | ||
Vector3f clickPosition | ||
); | ||
|
||
@FunctionalInterface | ||
interface Executor { | ||
|
||
boolean execute( | ||
BlockState blockState, | ||
Player player, | ||
Vector3i blockPosition, | ||
Direction face, | ||
Vector3f clickPosition | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
api/src/main/java/org/cloudburstmc/api/item/behavior/CanBePlacedOnBehavior.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.cloudburstmc.api.item.behavior; | ||
|
||
import org.cloudburstmc.api.block.Block; | ||
import org.cloudburstmc.api.item.ItemStack; | ||
import org.cloudburstmc.api.util.behavior.Behavior; | ||
|
||
public interface CanBePlacedOnBehavior { | ||
|
||
boolean get(Behavior<CanBePlacedOnBehavior.Executor> behavior, ItemStack item, Block block); | ||
|
||
@FunctionalInterface | ||
interface Executor { | ||
|
||
boolean execute(ItemStack itemStack, Block block); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
api/src/main/java/org/cloudburstmc/api/item/behavior/GetItemBehavior.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.cloudburstmc.api.item.behavior; | ||
|
||
import org.cloudburstmc.api.item.ItemStack; | ||
import org.cloudburstmc.api.util.behavior.Behavior; | ||
|
||
public interface GetItemBehavior<T> { | ||
|
||
T get(Behavior<Executor<T>> behavior, ItemStack item); | ||
|
||
@FunctionalInterface | ||
interface Executor<T> { | ||
|
||
T execute(ItemStack itemStack); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters