Interface MachineWorld
@NonExtendable
public interface MachineWorld
What a machine can see and do in the world around it (
MachineContext.world()). Every call
happens at once, on the owner thread; positions of blocks owned by another thread (Folia: another
region) or not loaded read as empty and are never changed.-
Method Summary
Modifier and TypeMethodDescription@Nullable net.kyori.adventure.key.KeyblockAt(@NotNull BlockPosition position) The block atposition: a CraftEngine block's id, or a vanilla block's (e.g.floatblockHardness(@NotNull BlockPosition position) How hard the block atpositionis to break (vanilla hardness); -1 if unbreakable or unknown.booleanbreakBlock(@NotNull BlockPosition position) Breaks the block atposition, its drops falling as items; false if it could not.@NotNull List<ResourceStack> collectItems(@NotNull BlockPosition position) Takes the dropped items lying in the block atposition(e.g.@Nullable WorldFluidfluidAt(@NotNull BlockPosition position) The fluid in the block atposition, ornullif there is none, or it is not loaded or owned.voidparticleLine(@NotNull BlockPosition to, int color) Draws particles from the machine toto(a beam), e.g.booleanplaceBlock(@NotNull BlockPosition position, @NotNull net.kyori.adventure.key.Key block) Places the vanilla blockblock(e.g.booleanplaceFluid(@NotNull BlockPosition position, @NotNull net.kyori.adventure.key.Key fluid) Places a source block of the platform'sfluid(e.g.voidplaySound(@NotNull net.kyori.adventure.key.Key sound, float volume, float pitch) Plays the platform'ssoundat the machine.intThe redstone signal this machine's block receives (0 to 15).voidsetBlockProperty(@NotNull String property, @NotNull String value) Shows a state of the machine on its block: sets the block propertyproperty(e.g.booleantakeFluid(@NotNull BlockPosition position) Removes the fluid source block atposition; false if there is none or it is not owned.
-
Method Details
-
blockAt
The block atposition: a CraftEngine block's id, or a vanilla block's (e.g.minecraft:air);nullif not loaded or not owned by this thread. -
fluidAt
The fluid in the block atposition, ornullif there is none, or it is not loaded or owned. -
blockHardness
How hard the block atpositionis to break (vanilla hardness); -1 if unbreakable or unknown. -
redstonePower
int redstonePower()The redstone signal this machine's block receives (0 to 15). -
placeFluid
boolean placeFluid(@NotNull @NotNull BlockPosition position, @NotNull @NotNull net.kyori.adventure.key.Key fluid) Places a source block of the platform'sfluid(e.g.minecraft:water) where there is air or flowing fluid. -
takeFluid
Removes the fluid source block atposition; false if there is none or it is not owned. -
placeBlock
boolean placeBlock(@NotNull @NotNull BlockPosition position, @NotNull @NotNull net.kyori.adventure.key.Key block) Places the vanilla blockblock(e.g.minecraft:stone) where there is air or a fluid. -
breakBlock
Breaks the block atposition, its drops falling as items; false if it could not. Machines and transports are never broken. -
collectItems
Takes the dropped items lying in the block atposition(e.g. a tractor beam), as resources. -
setBlockProperty
-
playSound
void playSound(@NotNull @NotNull net.kyori.adventure.key.Key sound, float volume, float pitch) Plays the platform'ssoundat the machine. -
particleLine
Draws particles from the machine toto(a beam), e.g.minecraft:dustincolor(RGB).
-