类 FluidTank
java.lang.Object
net.neoforged.neoforge.fluids.capability.templates.FluidTank
- 所有已实现的接口:
ValueIOSerializable
,IFluidHandler
,IFluidTank
Flexible implementation of a Fluid Storage object. NOT REQUIRED.
-
嵌套类概要
从接口继承的嵌套类/接口 net.neoforged.neoforge.fluids.capability.IFluidHandler
IFluidHandler.FluidAction
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
deserialize
(ValueInput input) drain
(int maxDrain, IFluidHandler.FluidAction action) Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.drain
(FluidStack resource, IFluidHandler.FluidAction action) Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.int
fill
(FluidStack resource, IFluidHandler.FluidAction action) Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler.int
getFluid()
int
getFluidInTank
(int tank) Returns the FluidStack in a given tank.int
getSpace()
int
getTankCapacity
(int tank) Retrieves the maximum fluid amount for a given tank.int
getTanks()
Returns the number of fluid storage units ("tanks") availableboolean
isEmpty()
boolean
isFluidValid
(int tank, FluidStack stack) This function is a way to determine which fluids can exist inside a given handler.boolean
isFluidValid
(FluidStack stack) protected void
void
serialize
(ValueOutput output) setCapacity
(int capacity) void
setFluid
(FluidStack stack) setValidator
(Predicate<FluidStack> validator)
-
字段详细资料
-
validator
-
fluid
-
capacity
protected int capacity
-
-
构造器详细资料
-
FluidTank
public FluidTank(int capacity) -
FluidTank
-
-
方法详细资料
-
setCapacity
-
setValidator
-
isFluidValid
- 指定者:
isFluidValid
在接口中IFluidTank
- 参数:
stack
- Fluidstack holding the Fluid to be queried.- 返回:
- If the tank can hold the fluid (EVER, not at the time of query).
-
getCapacity
public int getCapacity()- 指定者:
getCapacity
在接口中IFluidTank
- 返回:
- Capacity of this fluid tank.
-
getFluid
- 指定者:
getFluid
在接口中IFluidTank
- 返回:
- FluidStack representing the fluid in the tank, null if the tank is empty.
-
getFluidAmount
public int getFluidAmount()- 指定者:
getFluidAmount
在接口中IFluidTank
- 返回:
- Current amount of fluid in the tank.
-
deserialize
- 指定者:
deserialize
在接口中ValueIOSerializable
-
serialize
- 指定者:
serialize
在接口中ValueIOSerializable
-
getTanks
public int getTanks()从接口复制的说明:IFluidHandler
Returns the number of fluid storage units ("tanks") available- 指定者:
getTanks
在接口中IFluidHandler
- 返回:
- The number of tanks available
-
getFluidInTank
从接口复制的说明:IFluidHandler
Returns the FluidStack in a given tank.IMPORTANT: This FluidStack MUST NOT be modified. This method is not for altering internal contents. Any implementers who are able to detect modification via this method should throw an exception. It is ENTIRELY reasonable and likely that the stack returned here will be a copy.
SERIOUSLY: DO NOT MODIFY THE RETURNED FLUIDSTACK
- 指定者:
getFluidInTank
在接口中IFluidHandler
- 参数:
tank
- Tank to query.- 返回:
- FluidStack in a given tank. FluidStack.EMPTY if the tank is empty.
-
getTankCapacity
public int getTankCapacity(int tank) 从接口复制的说明:IFluidHandler
Retrieves the maximum fluid amount for a given tank.- 指定者:
getTankCapacity
在接口中IFluidHandler
- 参数:
tank
- Tank to query.- 返回:
- The maximum fluid amount held by the tank.
-
isFluidValid
从接口复制的说明:IFluidHandler
This function is a way to determine which fluids can exist inside a given handler. General purpose tanks will basically always return TRUE for this.- 指定者:
isFluidValid
在接口中IFluidHandler
- 参数:
tank
- Tank to query for validitystack
- Stack to test with for validity- 返回:
- TRUE if the tank can hold the FluidStack, not considering current state. (Basically, is a given fluid EVER allowed in this tank?) Return FALSE if the answer to that question is 'no.'
-
fill
从接口复制的说明:IFluidHandler
Fills fluid into internal tanks, distribution is left entirely to the IFluidHandler.- 指定者:
fill
在接口中IFluidHandler
- 指定者:
fill
在接口中IFluidTank
- 参数:
resource
- FluidStack representing the Fluid and maximum amount of fluid to be filled.action
- If SIMULATE, fill will only be simulated.- 返回:
- Amount of resource that was (or would have been, if simulated) filled.
-
drain
从接口复制的说明:IFluidHandler
Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.- 指定者:
drain
在接口中IFluidHandler
- 指定者:
drain
在接口中IFluidTank
- 参数:
resource
- FluidStack representing the Fluid and maximum amount of fluid to be drained.action
- If SIMULATE, drain will only be simulated.- 返回:
- FluidStack representing the Fluid and amount that was (or would have been, if simulated) drained.
-
drain
从接口复制的说明:IFluidHandler
Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler.This method is not Fluid-sensitive.
- 指定者:
drain
在接口中IFluidHandler
- 指定者:
drain
在接口中IFluidTank
- 参数:
maxDrain
- Maximum amount of fluid to drain.action
- If SIMULATE, drain will only be simulated.- 返回:
- FluidStack representing the Fluid and amount that was (or would have been, if simulated) drained.
-
onContentsChanged
protected void onContentsChanged() -
setFluid
-
isEmpty
public boolean isEmpty() -
getSpace
public int getSpace()
-