PylonFluidTank

A common pattern is a 'fluid tank' which can only store one fluid at a time, but can store many types of fluids. PylonFluidTank implements this pattern.

You must call setCapacity for this block to work.

As with PylonFluidBufferBlock, you do not need to handle saving buffers or implement any of the PylonFluidBlock methods for this; this is all done automatically.

Properties

Link copied to clipboard

The amount of fluid stored in the tank

Link copied to clipboard

The capacity of the tank

Link copied to clipboard

The amount of space remaining in the tank

Link copied to clipboard

The type of fluid stored in the tank

Functions

Link copied to clipboard
open fun addFluid(amount: Double): Boolean

Adds to the tank only if the new amount of fluid is greater than zero and fits in the tank.

Link copied to clipboard
open fun canSetFluid(amount: Double): Boolean

Checks if a new amount of fluid is greater than zero and fits inside the tank.

Link copied to clipboard
open override fun fluidAmountRequested(fluid: PylonFluid, deltaSeconds: Double): Double

Returns the amount of the given fluid that the machine wants to receive next tick.

Link copied to clipboard
Link copied to clipboard
open override fun getFacing(): BlockFace?
Link copied to clipboard
open override fun getSuppliedFluids(deltaSeconds: Double): Map<PylonFluid, Double>

Returns a map of fluid types - and their corresponding amounts - that can be supplied by the block for this fluid tick. deltaSeconds is the time since the last fluid tick.

Link copied to clipboard
abstract fun isAllowedFluid(fluid: PylonFluid): Boolean
Link copied to clipboard
open override fun onFluidAdded(fluid: PylonFluid, amount: Double)

amount is always at most getRequestedFluids().get(fluid) and will never be zero or less.

Link copied to clipboard
open override fun onFluidRemoved(fluid: PylonFluid, amount: Double)

amount is always at least getSuppliedFluids().get(fluid) and will never be zero or less.

Link copied to clipboard
open fun removeFluid(amount: Double): Boolean

Removes from the tank only if the new amount of fluid is greater than zero and fits in the tank.

Link copied to clipboard
open fun setCapacity(capacity: Double)

Sets the capacity of the fluid tank

Link copied to clipboard
open fun setFluid(amount: Double): Boolean

Sets the fluid amount only if the new amount of fluid is greater than zero and fits in the tank.

Link copied to clipboard
open fun setFluidType(fluid: PylonFluid?)

Sets the type of fluid in the fluid tank