java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer
All Implemented Interfaces:
EnergyNetComponent, ItemAttribute, MachineProcessHolder<CraftingOperation>, Placeable, InventoryBlock
Direct Known Subclasses:
AutoAnvil, AutoBrewer, AutoDisenchanter, AutoDrier, AutoEnchanter, BookBinder, CarbonPress, ChargingBench, ElectricDustWasher, ElectricFurnace, ElectricGoldPan, ElectricIngotFactory, ElectricIngotPulverizer, ElectricOreGrinder, ElectricPress, ElectricSmeltery, ElectrifiedCrucible, FoodComposter, FoodFabricator, Freezer, HeatedPressureChamber, OilPump, ProduceCollector, Refinery

public abstract class AContainer extends SlimefunItem implements InventoryBlock, EnergyNetComponent, MachineProcessHolder<CraftingOperation>
  • Field Details

  • Constructor Details

  • Method Details

    • onBlockBreak

      @Nonnull protected BlockBreakHandler onBlockBreak()
    • getMachineProcessor

      public MachineProcessor<CraftingOperation> getMachineProcessor()
      Description copied from interface: MachineProcessHolder
      This method returns our MachineProcessor instance.
      Specified by:
      getMachineProcessor in interface MachineProcessHolder<CraftingOperation>
      Returns:
      Our MachineProcessor
    • constructMenu

      protected void constructMenu(BlockMenuPreset preset)
    • getInventoryTitle

      @Nonnull public String getInventoryTitle()
      This method returns the title that is used for the Inventory of an AContainer that has been opened by a Player. Override this method to set the title.
      Returns:
      The title of the Inventory of this AContainer
    • getProgressBar

      public abstract ItemStack getProgressBar()
      This method returns the ItemStack that this AContainer will use as a progress bar. Override this method to set the progress bar.
      Returns:
      The ItemStack to use as the progress bar
    • getCapacity

      public int getCapacity()
      This method returns the max amount of electricity this machine can hold.
      Specified by:
      getCapacity in interface EnergyNetComponent
      Returns:
      The max amount of electricity this Block can store.
    • getEnergyConsumption

      public int getEnergyConsumption()
      This method returns the amount of energy that is consumed per operation.
      Returns:
      The rate of energy consumption
    • getSpeed

      public int getSpeed()
      This method returns the speed at which this machine will operate. This can be implemented on an instantiation-level to create different tiers of machines.
      Returns:
      The speed of this machine
    • setCapacity

      public final AContainer setCapacity(int capacity)
      This sets the energy capacity for this machine. This method must be called before registering the item and only before registering.
      Parameters:
      capacity - The amount of energy this machine can store
      Returns:
      This method will return the current instance of AContainer, so that can be chained.
    • setProcessingSpeed

      public final AContainer setProcessingSpeed(int speed)
      This sets the speed of this machine.
      Parameters:
      speed - The speed multiplier for this machine, must be above zero
      Returns:
      This method will return the current instance of AContainer, so that can be chained.
    • setEnergyConsumption

      public final AContainer setEnergyConsumption(int energyConsumption)
      This method sets the energy consumed by this machine per tick.
      Parameters:
      energyConsumption - The energy consumed per tick
      Returns:
      This method will return the current instance of AContainer, so that can be chained.
    • register

      public void register(@Nonnull SlimefunAddon addon)
      Description copied from class: SlimefunItem
      This method registers this SlimefunItem. Always call this method after your SlimefunItem has been initialized. Never call it more than once!
      Overrides:
      register in class SlimefunItem
      Parameters:
      addon - The SlimefunAddon that this SlimefunItem belongs to.
    • getMachineIdentifier

      @Nonnull public abstract String getMachineIdentifier()
      This method returns an internal identifier that is used to identify this AContainer and its recipes. When adding recipes to an AContainer we will use this identifier to identify all instances of the same AContainer. This way we can add the recipes to all instances of the same machine. This method will be deprecated and replaced in the future
      Returns:
      The identifier of this machine
    • registerDefaultRecipes

      protected void registerDefaultRecipes()
      This method registers all default recipes for this machine.
    • getMachineRecipes

      public List<MachineRecipe> getMachineRecipes()
    • getDisplayRecipes

      public List<ItemStack> getDisplayRecipes()
    • getInputSlots

      public int[] getInputSlots()
      Description copied from interface: InventoryBlock
      This method returns an Array of slots that serve as the input for the Inventory of this block.
      Specified by:
      getInputSlots in interface InventoryBlock
      Returns:
      The input slots for the Inventory of this block
    • getOutputSlots

      public int[] getOutputSlots()
      Description copied from interface: InventoryBlock
      This method returns an Array of slots that serve as the output for the Inventory of this block.
      Specified by:
      getOutputSlots in interface InventoryBlock
      Returns:
      The output slots for the Inventory of this block
    • getEnergyComponentType

      public EnergyNetComponentType getEnergyComponentType()
      Description copied from interface: EnergyNetComponent
      This method returns the Type of EnergyNetComponentType this SlimefunItem represents. It describes how this Block will interact with an EnergyNet.
      Specified by:
      getEnergyComponentType in interface EnergyNetComponent
      Returns:
      The EnergyNetComponentType this SlimefunItem represents.
    • registerRecipe

      public void registerRecipe(MachineRecipe recipe)
    • registerRecipe

      public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output)
    • registerRecipe

      public void registerRecipe(int seconds, ItemStack input, ItemStack output)
    • preRegister

      public void preRegister()
      Description copied from class: SlimefunItem
      This method is called before SlimefunItem.register(SlimefunAddon). Override this method to add any additional setup, adding an ItemHandler for example.
      Overrides:
      preRegister in class SlimefunItem
    • tick

      protected void tick(Block b)
    • takeCharge

      protected boolean takeCharge(@Nonnull Location l)
      This method will remove charge from a location if it is chargeable.
      Parameters:
      l - location to try to remove charge from
      Returns:
      Whether charge was taken if its chargeable
    • findNextRecipe

      protected MachineRecipe findNextRecipe(BlockMenu inv)