Interface MachineBlocks
public interface MachineBlocks
Changes machine and transport blocks in the world. Implemented by the block integration
(CraftEngine);
current() is empty headless and before MachineEngine has enabled.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable MachineBlockscurrent()The running server's block integration, ornull.@Nullable TransportSideModecycleTransportSide(@NotNull WorldPosition position, @NotNull Direction side) Cycles howsideof the transport atpositionconnects (default, pull, push, none), e.g.default booleanreplaceBlock(@NotNull WorldPosition position, @NotNull net.kyori.adventure.key.Key blockId) replaceBlock(WorldPosition, Key, Direction)keeping the facing.booleanreplaceBlock(@NotNull WorldPosition position, @NotNull net.kyori.adventure.key.Key blockId, @Nullable Direction facing) Replaces the machine block atpositionby the blockblockId(another machine, e.g.static voidsetCurrent(@Nullable MachineBlocks blocks) Set by the block integration when it starts and stops.
-
Method Details
-
replaceBlock
boolean replaceBlock(@NotNull @NotNull WorldPosition position, @NotNull @NotNull net.kyori.adventure.key.Key blockId, @Nullable @Nullable Direction facing) Replaces the machine block atpositionby the blockblockId(another machine, e.g. the next tier), keeping what the machine holds. Owner thread only. Nothing drops: the new machine takes the contents over.- Parameters:
facing- the new block's facing, ornullfor the old one- Returns:
- false if there is no machine there, it is busy (a process that cannot be cancelled, a transfer in flight), or the block could not be placed; nothing changed then
-
replaceBlock
default boolean replaceBlock(@NotNull @NotNull WorldPosition position, @NotNull @NotNull net.kyori.adventure.key.Key blockId) replaceBlock(WorldPosition, Key, Direction)keeping the facing. -
cycleTransportSide
@Nullable @Nullable TransportSideMode cycleTransportSide(@NotNull @NotNull WorldPosition position, @NotNull @NotNull Direction side) Cycles howsideof the transport atpositionconnects (default, pull, push, none), e.g. with a configurator. Owner thread only.- Returns:
- the new mode, or
nullif there is no transport there
-
current
The running server's block integration, ornull. -
setCurrent
Set by the block integration when it starts and stops.
-