Class MachineProcessor<T extends MachineOperation>
java.lang.Object
io.github.thebusybiscuit.slimefun4.core.machines.MachineProcessor<T>
- Type Parameters:
T- The type ofMachineOperationthis processor can hold.
A
MachineProcessor manages different MachineOperations and handles
their progress.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMachineProcessor(MachineProcessHolder<T> owner) This creates a newMachineProcessor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanendOperation(io.github.bakedlibs.dough.blocks.BlockPosition pos) This will end theMachineOperationat the givenBlockPosition.booleanThis will end theMachineOperationat the givenBlock.booleanendOperation(Location loc) This will end theMachineOperationat the givenLocation.getOperation(io.github.bakedlibs.dough.blocks.BlockPosition pos) This returns the currentMachineOperationat that givenBlockPosition.This returns the currentMachineOperationat that givenBlock.getOperation(Location loc) This returns the currentMachineOperationat that givenLocation.getOwner()This returns the owner of thisMachineProcessor.This returns the progress bar icon for thisMachineProcessoror null if no progress bar was set.voidsetProgressBar(ItemStack progressBar) This sets the progress bar icon for thisMachineProcessor.booleanstartOperation(io.github.bakedlibs.dough.blocks.BlockPosition pos, T operation) This method will actually start theMachineOperation.booleanstartOperation(Block b, T operation) This method will start aMachineOperationat the givenBlock.booleanstartOperation(Location loc, T operation) This method will start aMachineOperationat the givenLocation.voidupdateProgressBar(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 thisMachineProcessoror 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- AnItemStackor null
-
startOperation
This method will start aMachineOperationat the givenLocation.- Parameters:
loc- TheLocationat which our machine is located.operation- TheMachineOperationto start- Returns:
- Whether the
MachineOperationwas successfully started. This will return false if anotherMachineOperationhas already been started at thatLocation.
-
startOperation
This method will start aMachineOperationat the givenBlock.- Parameters:
b- TheBlockat which our machine is located.operation- TheMachineOperationto start- Returns:
- Whether the
MachineOperationwas successfully started. This will return false if anotherMachineOperationhas 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- TheBlockPositionof our machineoperation- TheMachineOperationto start- Returns:
- Whether the
MachineOperationwas successfully started. This will return false if anotherMachineOperationhas already been started at thatBlockPosition.
-
getOperation
This returns the currentMachineOperationat that givenLocation.- Parameters:
loc- TheLocationat which our machine is located.- Returns:
- The current
MachineOperationor null.
-
getOperation
This returns the currentMachineOperationat that givenBlock.- Parameters:
b- TheBlockat which our machine is located.- Returns:
- The current
MachineOperationor null.
-
getOperation
This returns the currentMachineOperationat that givenBlockPosition.- Parameters:
pos- TheBlockPositionat which our machine is located.- Returns:
- The current
MachineOperationor null.
-
endOperation
This will end theMachineOperationat the givenLocation.- Parameters:
loc- TheLocationat which our machine is located.- Returns:
- Whether the
MachineOperationwas successfully ended. This will return false if there was noMachineOperationto begin with.
-
endOperation
This will end theMachineOperationat the givenBlock.- Parameters:
b- TheBlockat which our machine is located.- Returns:
- Whether the
MachineOperationwas successfully ended. This will return false if there was noMachineOperationto begin with.
-
endOperation
public boolean endOperation(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition pos) This will end theMachineOperationat the givenBlockPosition.- Parameters:
pos- TheBlockPositionat which our machine is located.- Returns:
- Whether the
MachineOperationwas successfully ended. This will return false if there was noMachineOperationto begin with.
-
updateProgressBar
-