Class MachineProcessor<T extends MachineOperation>

java.lang.Object
io.github.thebusybiscuit.slimefun4.core.machines.MachineProcessor<T>
Type Parameters:
T - The type of MachineOperation this processor can hold.

public class MachineProcessor<T extends MachineOperation> extends Object
A MachineProcessor manages different MachineOperations and handles their progress.
Author:
TheBusyBiscuit
See Also:
  • Constructor Details

  • Method Details

    • getOwner

      @Nonnull public MachineProcessHolder<T> getOwner()
      This returns the owner of this MachineProcessor.
      Returns:
      The owner / holder
    • getProgressBar

      @Nullable public ItemStack getProgressBar()
      This returns the progress bar icon for this MachineProcessor or null if no progress bar was set.
      Returns:
      The progress bar icon or null
    • setProgressBar

      public void setProgressBar(@Nullable ItemStack progressBar)
      This sets the progress bar icon for this MachineProcessor. You can also set it to null to clear the progress bar.
      Parameters:
      progressBar - An ItemStack or null
    • startOperation

      public boolean startOperation(@Nonnull Location loc, @Nonnull T operation)
      This method will start a MachineOperation at the given Location.
      Parameters:
      loc - The Location at which our machine is located.
      operation - The MachineOperation to start
      Returns:
      Whether the MachineOperation was successfully started. This will return false if another MachineOperation has already been started at that Location.
    • startOperation

      public boolean startOperation(@Nonnull Block b, @Nonnull T operation)
      This method will start a MachineOperation at the given Block.
      Parameters:
      b - The Block at which our machine is located.
      operation - The MachineOperation to start
      Returns:
      Whether the MachineOperation was successfully started. This will return false if another MachineOperation has already been started at that Block.
    • startOperation

      public boolean startOperation(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition pos, @Nonnull T operation)
      This method will actually start the MachineOperation.
      Parameters:
      pos - The BlockPosition of our machine
      operation - The MachineOperation to start
      Returns:
      Whether the MachineOperation was successfully started. This will return false if another MachineOperation has already been started at that BlockPosition.
    • getOperation

      @Nullable public T getOperation(@Nonnull Location loc)
      This returns the current MachineOperation at that given Location.
      Parameters:
      loc - The Location at which our machine is located.
      Returns:
      The current MachineOperation or null.
    • getOperation

      @Nullable public T getOperation(@Nonnull Block b)
      This returns the current MachineOperation at that given Block.
      Parameters:
      b - The Block at which our machine is located.
      Returns:
      The current MachineOperation or null.
    • getOperation

      @Nullable public T getOperation(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition pos)
      This returns the current MachineOperation at that given BlockPosition.
      Parameters:
      pos - The BlockPosition at which our machine is located.
      Returns:
      The current MachineOperation or null.
    • endOperation

      public boolean endOperation(@Nonnull Location loc)
      This will end the MachineOperation at the given Location.
      Parameters:
      loc - The Location at which our machine is located.
      Returns:
      Whether the MachineOperation was successfully ended. This will return false if there was no MachineOperation to begin with.
    • endOperation

      public boolean endOperation(@Nonnull Block b)
      This will end the MachineOperation at the given Block.
      Parameters:
      b - The Block at which our machine is located.
      Returns:
      Whether the MachineOperation was successfully ended. This will return false if there was no MachineOperation to begin with.
    • endOperation

      public boolean endOperation(@Nonnull io.github.bakedlibs.dough.blocks.BlockPosition pos)
      This will end the MachineOperation at the given BlockPosition.
      Parameters:
      pos - The BlockPosition at which our machine is located.
      Returns:
      Whether the MachineOperation was successfully ended. This will return false if there was no MachineOperation to begin with.
    • updateProgressBar

      public void updateProgressBar(@Nonnull BlockMenu inv, int slot, @Nonnull T operation)