Skip to main content

BlockEngine

Index

Namespaces

Decorators

Decorators:

ClientSide

  • Client side method decorator for TileEntity


    Parameters

    Returns void

ContainerEvent

  • Adds method as container event in TileEntity


    Parameters

    Returns (target: TileEntityBase, propertyName: string) => void

NetworkEvent

  • Adds method as network event in TileEntity


    Parameters

    Returns (target: TileEntityBase, propertyName: string) => void

Classes

LiquidTank

LiquidTank:

Class to store and manipulate liquids in TileEntity.

constructor

  • new LiquidTank(tileEntity: TileEntity, name: string, limit: number, liquids?: string[]): LiquidTank
  • Creates new instance of LiquidTank and 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

data

data: { amount: number; liquid: string }

Liquid data stored in TileEntity data object.


Type declaration

  • amount: number
  • liquid: string

limit

limit: number

Max liquid amount.

liquids

liquids: object

Set of valid liquids

readonlyname

name: string

Liquid tank name

tileEntity

tileEntity: TileEntity

Parent TileEntity instance

addLiquid

  • addLiquid(liquid: string, amount: number): number
  • 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

  • addLiquidToItem(inputSlot: ItemContainerSlot, outputSlot: ItemContainerSlot): boolean
  • 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

  • getAmount(liquid?: string): number
  • Gets amount of liquid in tank. If liquid parameter is set, returns amount of the specified liquid.


    Parameters

    • optionalliquid: string

      liquid type

    Returns number

    amount of liquid

getLimit

  • getLimit(): number
  • Gets max amount of liquid in tank.


    Returns number

    amount of liquid

getLiquid

  • getLiquid(amount: number): number
  • getLiquid(liquid: string, amount: number): number
  • Gets liquid from tank.


    Parameters

    • amount: number

      max amount of liquid to get

    Returns number

    amount of got liquid

getLiquidFromItem

  • getLiquidFromItem(inputSlot: ItemContainerSlot, outputSlot: ItemContainerSlot): boolean
  • 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

  • getLiquidStored(): string
  • Gets type of liquid stored in tank.


    Returns string

    liquid type

getRelativeAmount

  • getRelativeAmount(): number
  • Gets amount of liquid divided by max amount.


    Returns number

    scalar value from 0 to 1

isEmpty

  • isEmpty(): boolean
  • Returns boolean

    true if tank is empty, false otherwise

isFull

  • isFull(): boolean
  • Returns boolean

    true if tank is full, false otherwise

isValidLiquid

  • isValidLiquid(liquid: string): boolean
  • Parameters

    • liquid: string

      liquid type

    Returns boolean

    true if liquid can be stored in tank, false otherwise.

setAmount

  • setAmount(liquid: string, amount: number): void
  • Sets liquid to tank.


    Parameters

    • liquid: string

      liquid type

    • amount: number

      amount of liquid

    Returns void

setParent

  • setParent(tileEntity: TileEntity): void
  • Binds liquid tank to TileEntity.


    Parameters

    • tileEntity: TileEntity

      TileEntity instance

    Returns void

setValidLiquids

  • setValidLiquids(liquids: string[]): void
  • Sets liquids that can be stored in tank.


    Parameters

    • liquids: string[]

      arrays of liquid types

    Returns void

updateUiScale

  • updateUiScale(scale: string): void
  • 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

Functions

getGameVersion

  • getGameVersion(): number[]
  • Returns number[]

    game version as array

getMainGameVersion

  • getMainGameVersion(): number
  • Returns number

    main game version number

sendMessage

  • sendMessage(client: NetworkClient, message: string, ...params: string[]): void
  • sendMessage(client: NetworkClient, color: EColor, message: string, ...params: string[]): void
  • Sends packet with message which will be translated by the client, the message can be parametrized using '%s' symbols as placeholders.


    Parameters

    • client: NetworkClient

      receiver client

    • message: string

      unlocalized string

    • rest...params: string[]

      array of unlocalized substrings that will be substituted into the message after translation

    Returns void

sendUnlocalizedMessage

  • sendUnlocalizedMessage(client: NetworkClient, ...texts: string[]): void
  • Sends packet with message which will be translated by the client.

    That feature is obsolete

    Use sendMessage instead.


    Parameters

    • client: NetworkClient
    • rest...texts: string[]

    Returns void