BlockEngine.LiquidTank
Index
Constructors
constructor
Creates new instance of
LiquidTankand binds it to TileEntity.Parameters
tileEntity: TileEntity
TileEntity instance
name: string
liquid tank name
limit: number
max liquid amount
optionalliquids: string[]
types of valid liquids
Returns LiquidTank
Properties
data
Liquid data stored in TileEntity data object.
Type declaration
amount: number
liquid: string
limit
Max liquid amount.
liquids
Set of valid liquids
readonlyname
Liquid tank name
tileEntity
Parent TileEntity instance
Methods
addLiquid
Adds liquid to tank.
Parameters
liquid: string
liquid type
amount: number
amount of liquid to add
Returns number
amount of liquid that wasn't added
addLiquidToItem
Tries to fill item with liquid from tank.
Parameters
inputSlot: ItemContainerSlot
slot for empty item
outputSlot: ItemContainerSlot
slot for full item
Returns boolean
true if liquid was added, false otherwise.
getAmount
Gets amount of liquid in tank. If
liquidparameter is set, returns amount of the specified liquid.Parameters
optionalliquid: string
liquid type
Returns number
amount of liquid
getLimit
Gets max amount of liquid in tank.
Returns number
amount of liquid
getLiquid
Gets liquid from tank.
Parameters
amount: number
max amount of liquid to get
Returns number
amount of got liquid
getLiquidFromItem
Tries to fill tank with liquid from item.
Parameters
inputSlot: ItemContainerSlot
slot for full item
outputSlot: ItemContainerSlot
slot for empty item
Returns boolean
true if liquid was extracted, false otherwise.
getLiquidStored
Gets type of liquid stored in tank.
Returns string
liquid type
getRelativeAmount
Gets amount of liquid divided by max amount.
Returns number
scalar value from 0 to 1
isEmpty
Returns boolean
true if tank is empty, false otherwise
isFull
Returns boolean
true if tank is full, false otherwise
isValidLiquid
Parameters
liquid: string
liquid type
Returns boolean
true if liquid can be stored in tank, false otherwise.
setAmount
Sets liquid to tank.
Parameters
liquid: string
liquid type
amount: number
amount of liquid
Returns void
setParent
Binds liquid tank to TileEntity.
Parameters
tileEntity: TileEntity
TileEntity instance
Returns void
setValidLiquids
Sets liquids that can be stored in tank.
Parameters
liquids: string[]
arrays of liquid types
Returns void
updateUiScale
Updates UI bar of liquid. Uses LiquidStorage method for legacy container and container event from TileEntityBase for multiplayer container.
Parameters
scale: string
name of liquid bar
Returns void
Class to store and manipulate liquids in TileEntity.