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
FieldsFields inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addon, disenchantable, enchantable, hidden, recipeOutput, useableInWorkbench -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAContainer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, org.bukkit.inventory.ItemStack[] recipe) protectedAContainer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, org.bukkit.inventory.ItemStack[] recipe, org.bukkit.inventory.ItemStack recipeOutput) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconstructMenu(BlockMenuPreset preset) voiddisable()This method is called when thisSlimefunItemis disabled after reloaded.voidenable()protected MachineRecipefindNextRecipe(BlockMenu inv) intThis method returns the max amount of electricity this machine can hold.List<org.bukkit.inventory.ItemStack> This method returns the Type ofEnergyNetComponentTypethisSlimefunItemrepresents.intThis method returns the amount of energy that is consumed per operation.int[]This method returns anArrayof slots that serve as the input for theInventoryof this block.This method returns the title that is used for theInventoryof anAContainerthat has been opened by a Player.abstract StringThis method returns an internal identifier that is used to identify thisAContainerand its recipes.This method returns ourMachineProcessorinstance.int[]This method returns anArrayof slots that serve as the output for theInventoryof this block.abstract org.bukkit.inventory.ItemStackThis method returns theItemStackthat thisAContainerwill use as a progress bar.intgetSpeed()This method returns the speed at which this machine will operate.protected BlockBreakHandlervoidThis method is called afterSlimefunItem.register(SlimefunAddon).voidThis method is called beforeSlimefunItem.register(SlimefunAddon).voidregister(SlimefunAddon addon) This method registers thisSlimefunItem.protected voidThis method registers all default recipes for this machine.voidregisterRecipe(int seconds, org.bukkit.inventory.ItemStack[] input, org.bukkit.inventory.ItemStack[] output) voidregisterRecipe(int seconds, org.bukkit.inventory.ItemStack input, org.bukkit.inventory.ItemStack output) voidregisterRecipe(MachineRecipe recipe) final AContainersetCapacity(int capacity) This sets the energy capacity for this machine.final AContainersetEnergyConsumption(int energyConsumption) This method sets the energy consumed by this machine per tick.final AContainersetProcessingSpeed(int speed) This sets the speed of this machine.protected booleantakeCharge(org.bukkit.Location l) This method will remove charge from a location if it is chargeable.protected voidtick(org.bukkit.block.Block b) Methods inherited from class io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem
addItemHandler, addItemSetting, addOfficialWikipage, addWikiPage, 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, loadDataByDefault, sendDeprecationWarning, setHidden, setItemGroup, setRecipe, setRecipeOutput, setRecipeType, setResearch, setUseableInWorkbench, toString, warnMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent
addCharge, addCharge, getCapacityLong, getCharge, getCharge, getCharge, getCharge, getChargeLong, getChargeLong, getChargeLong, isChargeable, removeCharge, removeCharge, setCharge, setChargeMethods inherited from interface me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock
createPreset, createPresetMethods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.ItemAttribute
getIdMethods 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, org.bukkit.inventory.ItemStack[] recipe) -
AContainer
@ParametersAreNonnullByDefault protected AContainer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, org.bukkit.inventory.ItemStack[] recipe, org.bukkit.inventory.ItemStack recipeOutput)
-
-
Method Details
-
onBlockBreak
-
getMachineProcessor
Description copied from interface:MachineProcessHolderThis method returns ourMachineProcessorinstance.- Specified by:
getMachineProcessorin interfaceMachineProcessHolder<CraftingOperation>- Returns:
- Our
MachineProcessor
-
constructMenu
-
getInventoryTitle
This method returns the title that is used for theInventoryof anAContainerthat has been opened by a Player. Override this method to set the title.- Returns:
- The title of the
Inventoryof thisAContainer
-
getProgressBar
public abstract org.bukkit.inventory.ItemStack getProgressBar()This method returns theItemStackthat thisAContainerwill use as a progress bar. Override this method to set the progress bar.- Returns:
- The
ItemStackto use as the progress bar
-
getCapacity
public int getCapacity()This method returns the max amount of electricity this machine can hold.- Specified by:
getCapacityin 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:SlimefunItemThis method registers thisSlimefunItem. Always call this method after yourSlimefunItemhas been initialized. Never call it more than once!- Overrides:
registerin classSlimefunItem- Parameters:
addon- TheSlimefunAddonthat thisSlimefunItembelongs to.
-
getMachineIdentifier
This method returns an internal identifier that is used to identify thisAContainerand its recipes. When adding recipes to anAContainerwe 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:InventoryBlockThis method returns anArrayof slots that serve as the input for theInventoryof this block.- Specified by:
getInputSlotsin interfaceInventoryBlock- Returns:
- The input slots for the
Inventoryof this block
-
getOutputSlots
public int[] getOutputSlots()Description copied from interface:InventoryBlockThis method returns anArrayof slots that serve as the output for theInventoryof this block.- Specified by:
getOutputSlotsin interfaceInventoryBlock- Returns:
- The output slots for the
Inventoryof this block
-
getEnergyComponentType
Description copied from interface:EnergyNetComponentThis method returns the Type ofEnergyNetComponentTypethisSlimefunItemrepresents. It describes how this Block will interact with anEnergyNet.- Specified by:
getEnergyComponentTypein interfaceEnergyNetComponent- Returns:
- The
EnergyNetComponentTypethisSlimefunItemrepresents.
-
registerRecipe
-
registerRecipe
public void registerRecipe(int seconds, org.bukkit.inventory.ItemStack[] input, org.bukkit.inventory.ItemStack[] output) -
registerRecipe
public void registerRecipe(int seconds, org.bukkit.inventory.ItemStack input, org.bukkit.inventory.ItemStack output) -
preRegister
public void preRegister()Description copied from class:SlimefunItemThis method is called beforeSlimefunItem.register(SlimefunAddon). Override this method to add any additional setup, adding anItemHandlerfor example.- Overrides:
preRegisterin classSlimefunItem
-
tick
protected void tick(org.bukkit.block.Block b) -
takeCharge
protected boolean takeCharge(@Nonnull org.bukkit.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
-
enable
public void enable()- Overrides:
enablein classSlimefunItem
-
disable
public void disable()Description copied from class:SlimefunItemThis method is called when thisSlimefunItemis disabled after reloaded.- Overrides:
disablein classSlimefunItem
-
postRegister
public void postRegister()Description copied from class:SlimefunItemThis method is called afterSlimefunItem.register(SlimefunAddon). Override this method to add any additional setup that needs to happen after the original registration of thisSlimefunItem.- Overrides:
postRegisterin classSlimefunItem
-