FluidContainer

class FluidContainer(val uuid: UUID, val allowedTypes: Set<FluidType>, val capacityProvider: Provider<Long>, val typeProvider: MutableProvider<FluidType?>, val amountProvider: MutableProvider<Long>) : NetworkedFluidContainer

The default implementation for NetworkedFluidContainer.

Constructors

Link copied to clipboard
constructor(compound: Provider<Compound>, uuid: UUID, allowedTypes: Set<FluidType>, capacityProvider: Provider<Long>)
constructor(uuid: UUID, allowedTypes: Set<FluidType>, capacityProvider: Provider<Long>, typeProvider: MutableProvider<FluidType?>, amountProvider: MutableProvider<Long>)

Properties

Link copied to clipboard
open override val allowedTypes: Set<FluidType>

The allowed fluid types that can be stored in this NetworkedFluidContainer.

Link copied to clipboard
open override var amount: Long

The amount of fluid currently in this NetworkedFluidContainer.

Link copied to clipboard
val amountProvider: MutableProvider<Long>
Link copied to clipboard
open override val capacity: Long

The amount of fluid that can fit in this NetworkedFluidContainer.

Link copied to clipboard
val capacityProvider: Provider<Long>
Link copied to clipboard
open override var type: FluidType?

The current FluidType of this NetworkedFluidContainer or null if the container does not contain any fluid.

Link copied to clipboard
val typeProvider: MutableProvider<FluidType?>
Link copied to clipboard
open override val uuid: UUID

The unique identifier of this EndPointContainer.

Functions

Link copied to clipboard
open fun accepts(type: FluidType): Boolean

Whether this NetworkedFluidContainer can accept type.

open fun accepts(type: FluidType, amount: Long): Boolean

Whether this NetworkedFluidContainer can accept amount of type.

Link copied to clipboard
open override fun addFluid(type: FluidType, amount: Long): Long

Tries to add amount of type to this NetworkedFluidContainer, then returns the amount that was actually added.

Link copied to clipboard
fun addUpdateHandler(handler: () -> Unit)

Registers an update handler that is called when the container is updated.

Link copied to clipboard
fun clear()

Removes all fluid from this container.

Link copied to clipboard
open fun isEmpty(): Boolean

Whether this NetworkedFluidContainer is empty.

Link copied to clipboard
open fun isFull(): Boolean

Whether this NetworkedFluidContainer can accept any more fluid.

Link copied to clipboard
open override fun takeFluid(amount: Long): Long

Tries to take amount of fluid from this NetworkedFluidContainer, then returns the amount that was actually taken.