Class AContainer
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 Summary
Fields inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addon, disenchantable, enchantable, hidden, recipeOutput, useableInWorkbench
-
Constructor Summary
ModifierConstructorDescriptionprotected
AContainer
(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) protected
AContainer
(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
constructMenu
(BlockMenuPreset preset) protected MachineRecipe
findNextRecipe
(BlockMenu inv) int
This method returns the max amount of electricity this machine can hold.This method returns the Type ofEnergyNetComponentType
thisSlimefunItem
represents.int
This method returns the amount of energy that is consumed per operation.int[]
This method returns the title that is used for theInventory
of anAContainer
that has been opened by a Player.abstract String
This method returns an internal identifier that is used to identify thisAContainer
and its recipes.This method returns ourMachineProcessor
instance.int[]
abstract ItemStack
This method returns theItemStack
that thisAContainer
will use as a progress bar.int
getSpeed()
This method returns the speed at which this machine will operate.protected BlockBreakHandler
void
This method is called beforeSlimefunItem.register(SlimefunAddon)
.void
register
(SlimefunAddon addon) This method registers thisSlimefunItem
.protected void
This method registers all default recipes for this machine.void
registerRecipe
(int seconds, ItemStack[] input, ItemStack[] output) void
registerRecipe
(int seconds, ItemStack input, ItemStack output) void
registerRecipe
(MachineRecipe recipe) final AContainer
setCapacity
(int capacity) This sets the energy capacity for this machine.final AContainer
setEnergyConsumption
(int energyConsumption) This method sets the energy consumed by this machine per tick.final AContainer
setProcessingSpeed
(int speed) This sets the speed of this machine.protected boolean
This method will remove charge from a location if it is chargeable.protected void
Methods inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addItemHandler, addItemSetting, addOfficialWikipage, callItemHandler, canUse, equals, error, getAddon, getBlockTicker, getById, getByItem, getDrops, getDrops, getHandlers, getId, getItem, getItemGroup, getItemName, getItemSetting, getItemSettings, getOptionalById, getOptionalByItem, getRecipe, getRecipeOutput, getRecipeType, getResearch, getState, getWikipage, hashCode, hasResearch, info, isDisabled, isDisabledIn, isDisenchantable, isEnchantable, isHidden, isItem, isItemStackImmutable, isTicking, isUseableInWorkbench, load, postRegister, sendDeprecationWarning, setHidden, setItemGroup, setRecipe, setRecipeOutput, setRecipeType, setResearch, setUseableInWorkbench, toString, warn
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent
addCharge, getCharge, getCharge, isChargeable, removeCharge, setCharge
Methods inherited from interface me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock
createPreset, createPreset
Methods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.ItemAttribute
getId
Methods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.Placeable
useVanillaBlockBreaking
-
Field Details
-
recipes
-
-
Constructor Details
-
AContainer
@ParametersAreNonnullByDefault protected AContainer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) -
AContainer
@ParametersAreNonnullByDefault protected AContainer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput)
-
-
Method Details
-
onBlockBreak
-
getMachineProcessor
Description copied from interface:MachineProcessHolder
This method returns ourMachineProcessor
instance.- Specified by:
getMachineProcessor
in interfaceMachineProcessHolder<CraftingOperation>
- Returns:
- Our
MachineProcessor
-
constructMenu
-
getInventoryTitle
This method returns the title that is used for theInventory
of anAContainer
that has been opened by a Player. Override this method to set the title.- Returns:
- The title of the
Inventory
of thisAContainer
-
getProgressBar
This method returns theItemStack
that thisAContainer
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 interfaceEnergyNetComponent
- 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
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
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
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
Description copied from class:SlimefunItem
This method registers thisSlimefunItem
. Always call this method after yourSlimefunItem
has been initialized. Never call it more than once!- Overrides:
register
in classSlimefunItem
- Parameters:
addon
- TheSlimefunAddon
that thisSlimefunItem
belongs to.
-
getMachineIdentifier
This method returns an internal identifier that is used to identify thisAContainer
and its recipes. When adding recipes to anAContainer
we will use this identifier to identify all instances of the sameAContainer
. 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
-
getDisplayRecipes
-
getInputSlots
public int[] getInputSlots()Description copied from interface:InventoryBlock
- Specified by:
getInputSlots
in interfaceInventoryBlock
- Returns:
- The input slots for the
Inventory
of this block
-
getOutputSlots
public int[] getOutputSlots()Description copied from interface:InventoryBlock
- Specified by:
getOutputSlots
in interfaceInventoryBlock
- Returns:
- The output slots for the
Inventory
of this block
-
getEnergyComponentType
Description copied from interface:EnergyNetComponent
This method returns the Type ofEnergyNetComponentType
thisSlimefunItem
represents. It describes how this Block will interact with anEnergyNet
.- Specified by:
getEnergyComponentType
in interfaceEnergyNetComponent
- Returns:
- The
EnergyNetComponentType
thisSlimefunItem
represents.
-
registerRecipe
-
registerRecipe
-
registerRecipe
-
preRegister
public void preRegister()Description copied from class:SlimefunItem
This method is called beforeSlimefunItem.register(SlimefunAddon)
. Override this method to add any additional setup, adding anItemHandler
for example.- Overrides:
preRegister
in classSlimefunItem
-
tick
-
takeCharge
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
-