Class Multiblocks
java.lang.Object
fr.robie.machineengine.api.multiblock.Multiblocks
Finding multiblocks in the world, and the formed ones (D33). Detection only reads blocks, through a
blockAt function (MachineWorld.blockAt(BlockPosition) for a
machine), so it runs on the thread that owns them; every block must be loaded and owned.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Forgets every structure (tests).static @Nullable MultiblockStructurecontaining(@NotNull WorldPosition position) The formed structurepositionbelongs to, ornull.static @Nullable MultiblockStructuredetect(@NotNull MachineContext context, @NotNull WorldPosition start, @NotNull MultiblockType type) detect(Key, Function, BlockPosition, MultiblockType)with the machine's own world view.static @Nullable MultiblockStructuredetect(@NotNull net.kyori.adventure.key.Key world, @NotNull Function<BlockPosition, net.kyori.adventure.key.Key> blockAt, @NotNull BlockPosition start, @NotNull MultiblockType type) The structure oftypethat the block atstartis part of, ornullif there is no complete one.static voidform(@NotNull MultiblockStructure structure) Records a formed structure; one overlapping it (rebuilt bigger, smaller or turned) is replaced.static voidunform(@NotNull MultiblockStructure structure)
-
Method Details
-
containing
@Nullable public static @Nullable MultiblockStructure containing(@NotNull @NotNull WorldPosition position) The formed structurepositionbelongs to, ornull. -
form
Records a formed structure; one overlapping it (rebuilt bigger, smaller or turned) is replaced. -
unform
-
clear
public static void clear()Forgets every structure (tests). -
detect
@Nullable public static @Nullable MultiblockStructure detect(@NotNull @NotNull MachineContext context, @NotNull @NotNull WorldPosition start, @NotNull @NotNull MultiblockType type) detect(Key, Function, BlockPosition, MultiblockType)with the machine's own world view. -
detect
@Nullable public static @Nullable MultiblockStructure detect(@NotNull @NotNull net.kyori.adventure.key.Key world, @NotNull @NotNull Function<BlockPosition, net.kyori.adventure.key.Key> blockAt, @NotNull @NotNull BlockPosition start, @NotNull @NotNull MultiblockType type) The structure oftypethat the block atstartis part of, ornullif there is no complete one.- Parameters:
blockAt- the block id at a position,nullwhen not loaded or not owned
-