Class MachineProcessor<T extends MachineOperation>
java.lang.Object
io.github.thebusybiscuit.slimefun4.core.machines.MachineProcessor<T>
- Type Parameters:
T
- The type ofMachineOperation
this processor can hold.
A
MachineProcessor
manages different MachineOperation
s and handles
their progress.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
ConstructorDescriptionMachineProcessor
(MachineProcessHolder<T> owner) This creates a newMachineProcessor
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
endOperation
(io.github.bakedlibs.dough.blocks.BlockPosition pos) This will end theMachineOperation
at the givenBlockPosition
.boolean
This will end theMachineOperation
at the givenBlock
.boolean
endOperation
(Location loc) This will end theMachineOperation
at the givenLocation
.getOperation
(io.github.bakedlibs.dough.blocks.BlockPosition pos) This returns the currentMachineOperation
at that givenBlockPosition
.This returns the currentMachineOperation
at that givenBlock
.getOperation
(Location loc) This returns the currentMachineOperation
at that givenLocation
.getOwner()
This returns the owner of thisMachineProcessor
.This returns the progress bar icon for thisMachineProcessor
or null if no progress bar was set.void
setProgressBar
(ItemStack progressBar) This sets the progress bar icon for thisMachineProcessor
.boolean
startOperation
(io.github.bakedlibs.dough.blocks.BlockPosition pos, T operation) This method will actually start theMachineOperation
.boolean
startOperation
(Block b, T operation) This method will start aMachineOperation
at the givenBlock
.boolean
startOperation
(Location loc, T operation) This method will start aMachineOperation
at the givenLocation
.void
updateProgressBar
(BlockMenu inv, int slot, T operation)
-
Constructor Details
-
MachineProcessor
This creates a newMachineProcessor
.- Parameters:
owner
- The owner of thisMachineProcessor
.
-
-
Method Details
-
getOwner
This returns the owner of thisMachineProcessor
.- Returns:
- The owner / holder
-
getProgressBar
This returns the progress bar icon for thisMachineProcessor
or null if no progress bar was set.- Returns:
- The progress bar icon or null
-
setProgressBar
This sets the progress bar icon for thisMachineProcessor
. You can also set it to null to clear the progress bar.- Parameters:
progressBar
- AnItemStack
or null
-
startOperation
This method will start aMachineOperation
at the givenLocation
.- Parameters:
loc
- TheLocation
at which our machine is located.operation
- TheMachineOperation
to start- Returns:
- Whether the
MachineOperation
was successfully started. This will return false if anotherMachineOperation
has already been started at thatLocation
.
-
startOperation
This method will start aMachineOperation
at the givenBlock
.- Parameters:
b
- TheBlock
at which our machine is located.operation
- TheMachineOperation
to start- Returns:
- Whether the
MachineOperation
was successfully started. This will return false if anotherMachineOperation
has already been started at thatBlock
.
-
startOperation
public boolean startOperation(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition pos, @Nonnull T operation) This method will actually start theMachineOperation
.- Parameters:
pos
- TheBlockPosition
of our machineoperation
- TheMachineOperation
to start- Returns:
- Whether the
MachineOperation
was successfully started. This will return false if anotherMachineOperation
has already been started at thatBlockPosition
.
-
getOperation
This returns the currentMachineOperation
at that givenLocation
.- Parameters:
loc
- TheLocation
at which our machine is located.- Returns:
- The current
MachineOperation
or null.
-
getOperation
This returns the currentMachineOperation
at that givenBlock
.- Parameters:
b
- TheBlock
at which our machine is located.- Returns:
- The current
MachineOperation
or null.
-
getOperation
This returns the currentMachineOperation
at that givenBlockPosition
.- Parameters:
pos
- TheBlockPosition
at which our machine is located.- Returns:
- The current
MachineOperation
or null.
-
endOperation
This will end theMachineOperation
at the givenLocation
.- Parameters:
loc
- TheLocation
at which our machine is located.- Returns:
- Whether the
MachineOperation
was successfully ended. This will return false if there was noMachineOperation
to begin with.
-
endOperation
This will end theMachineOperation
at the givenBlock
.- Parameters:
b
- TheBlock
at which our machine is located.- Returns:
- Whether the
MachineOperation
was successfully ended. This will return false if there was noMachineOperation
to begin with.
-
endOperation
public boolean endOperation(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition pos) This will end theMachineOperation
at the givenBlockPosition
.- Parameters:
pos
- TheBlockPosition
at which our machine is located.- Returns:
- Whether the
MachineOperation
was successfully ended. This will return false if there was noMachineOperation
to begin with.
-
updateProgressBar
-