Package org.cyclops.cyclopscore.fluid
Class Tank
java.lang.Object
net.neoforged.neoforge.fluids.capability.templates.FluidTank
org.cyclops.cyclopscore.fluid.Tank
- All Implemented Interfaces:
net.neoforged.neoforge.common.util.ValueIOSerializable
,net.neoforged.neoforge.fluids.capability.IFluidHandler
,net.neoforged.neoforge.fluids.IFluidTank
,IFluidHandlerCapacity
,IFluidHandlerMutable
- Direct Known Subclasses:
SingleUseTank
public class Tank
extends net.neoforged.neoforge.fluids.capability.templates.FluidTank
implements IFluidHandlerCapacity, IFluidHandlerMutable
A simple fluid tank.
Based on the Buildcraft Tank
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.neoforged.neoforge.fluids.capability.IFluidHandler
net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction
-
Field Summary
Fields inherited from class net.neoforged.neoforge.fluids.capability.templates.FluidTank
capacity, fluid, validator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
deserialize
(net.minecraft.world.level.storage.ValueInput input) void
deserialize
(net.minecraft.world.level.storage.ValueInput input, String tag) void
deserializeTank
(net.minecraft.world.level.storage.ValueInput input) Read the tank contents from NBT.net.minecraft.world.level.material.Fluid
Get the fluid that currently occupies this tank, will return null if there is no fluid.int
getTankCapacity
(int tank) boolean
isEmpty()
Check if this tank is empty.boolean
isFull()
Check if this tank is full; the capacity is reached.protected boolean
void
serialize
(net.minecraft.world.level.storage.ValueOutput output) void
void
serializeTank
(net.minecraft.world.level.storage.ValueOutput output) Write the tank contents to NBT.void
setFluidInTank
(int tank, net.neoforged.neoforge.fluids.FluidStack fluidStack) void
setTankCapacity
(int tank, int capacity) Methods inherited from class net.neoforged.neoforge.fluids.capability.templates.FluidTank
drain, drain, fill, getCapacity, getFluid, getFluidAmount, getFluidInTank, getSpace, getTanks, isFluidValid, isFluidValid, onContentsChanged, setCapacity, setFluid, setValidator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.neoforge.fluids.capability.IFluidHandler
drain, drain, fill, getFluidInTank, getTanks, isFluidValid
-
Constructor Details
-
Tank
public Tank(int capacity) Make a new fluid tank.- Parameters:
capacity
- The capacity (mB) for the tank.
-
-
Method Details
-
isEmpty
public boolean isEmpty()Check if this tank is empty.- Overrides:
isEmpty
in classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
- Returns:
- If the tank is empty; no fluid is inside of it.
-
isFull
public boolean isFull()Check if this tank is full; the capacity is reached.- Returns:
- If this tank is full.
-
getFluidType
public net.minecraft.world.level.material.Fluid getFluidType()Get the fluid that currently occupies this tank, will return null if there is no fluid.- Returns:
- The inner fluid.
-
replaceInnerFluid
protected boolean replaceInnerFluid() -
serialize
public void serialize(net.minecraft.world.level.storage.ValueOutput output) - Specified by:
serialize
in interfacenet.neoforged.neoforge.common.util.ValueIOSerializable
- Overrides:
serialize
in classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
-
serialize
-
deserialize
public void deserialize(net.minecraft.world.level.storage.ValueInput input) - Specified by:
deserialize
in interfacenet.neoforged.neoforge.common.util.ValueIOSerializable
- Overrides:
deserialize
in classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
-
deserialize
-
serializeTank
public void serializeTank(net.minecraft.world.level.storage.ValueOutput output) Write the tank contents to NBT.- Parameters:
output
- The value tag to write to.
-
deserializeTank
public void deserializeTank(net.minecraft.world.level.storage.ValueInput input) Read the tank contents from NBT.- Parameters:
input
- The value to write from.
-
setFluidInTank
public void setFluidInTank(int tank, net.neoforged.neoforge.fluids.FluidStack fluidStack) - Specified by:
setFluidInTank
in interfaceIFluidHandlerMutable
-
setTankCapacity
public void setTankCapacity(int tank, int capacity) - Specified by:
setTankCapacity
in interfaceIFluidHandlerCapacity
-
getTankCapacity
public int getTankCapacity(int tank) - Specified by:
getTankCapacity
in interfacenet.neoforged.neoforge.fluids.capability.IFluidHandler
- Specified by:
getTankCapacity
in interfaceIFluidHandlerCapacity
- Overrides:
getTankCapacity
in classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
-