类 BlockFluidContainerComponent实验性

表示世界中方块的流体容器。像炼药锅这样的方块。

Represents the fluid container of a block in the world. Used with blocks like cauldrons.

层级 (查看层级一览)

属性

block: Block

此组件所属的方块实例。

Block instance that this component pertains to.

fillLevel: number

表示流体容器的相对填充水平。

Relative fill level of the fluid container.

无法在只读模式下修改此属性,详见 WorldBeforeEvents

fluidColor: RGBA

表示容器中流体的自定义颜色。

Custom color of the fluid in the container.

无法在只读模式下修改此属性,详见 WorldBeforeEvents

isValid: boolean

返回组件是否有效。若组件的拥有者有效,并且组件需要的任何 额外验证也通过,则该组件被认为是有效的。

Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.

typeId: string

组件的标识符。 Identifier of the component.

componentId: "minecraft:fluidContainer" = 'minecraft:fluidContainer'

方法

  • 实验性

    参数

    返回 void

    向流体中添加染料。染料颜色与任何现有的自定义颜色结合。

    Adds a dye to the fluid. The dye color is combined with any existing custom color.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    This function can throw errors.

    Error

  • 实验性

    返回 FluidType

    获取容器中当前的流体类型。

    Gets the current fluid type in the container.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    This function can throw errors.

    Error

  • 实验性

    参数

    返回 void

    设置容器中当前的流体类型。

    Sets the current fluid type in the container.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    This function can throw errors.

    Error

  • 实验性

    参数

    返回 void

    在容器中设置药水物品。将容器的流体类型更改为药水。

    Sets a potion item in the container. Changes the container's fluid type to potion.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    This function can throw errors.

    Error