Interface ICraftingMachine
public interface ICraftingMachine
Provides crafting services to adjacent pattern providers for automatic crafting. Can be provided via capability on
your block entity.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup<ICraftingMachine,net.minecraft.core.Direction> -
Method Summary
Modifier and TypeMethodDescriptionbooleancheck if the crafting machine is accepting pushes via pushPattern, if this is false, all calls to push will fail, you can try inserting into the inventory instead.default PatternContainerGroupdefault Optional<net.minecraft.network.chat.Component>Deprecated, for removal: This API element is subject to removal in a future version.static ICraftingMachineof(net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.core.Direction side) static ICraftingMachineof(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity) booleanpushPattern(IPatternDetails patternDetails, KeyCounter[] inputs, net.minecraft.core.Direction ejectionDirection) inserts a crafting plan, and the necessary items into the crafting machine.
-
Field Details
-
SIDED
static final net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup<ICraftingMachine,net.minecraft.core.Direction> SIDED
-
-
Method Details
-
of
@Nullable static ICraftingMachine of(@Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity, net.minecraft.core.Direction side) -
of
@Nullable static ICraftingMachine of(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity) -
getCraftingMachineInfo
-
getDisplayName
@Deprecated(forRemoval=true) default Optional<net.minecraft.network.chat.Component> getDisplayName()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- An optional name for this crafting machine, which can be shown in the pattern provider terminal for adjacent pattern providers that point to this crafting machine.
-
pushPattern
boolean pushPattern(IPatternDetails patternDetails, KeyCounter[] inputs, net.minecraft.core.Direction ejectionDirection) inserts a crafting plan, and the necessary items into the crafting machine.- Parameters:
inputs- The crafting ingredients. The array layout corresponds toIPatternDetails.getInputs()ofpatternDetails.- Returns:
- if it was accepted, all or nothing.
-
acceptsPlans
boolean acceptsPlans()check if the crafting machine is accepting pushes via pushPattern, if this is false, all calls to push will fail, you can try inserting into the inventory instead.- Returns:
- true, if pushPattern can complete, if its false push will always be false.
-