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 TypeMethodDescriptionvoiddeserialize(net.minecraft.world.level.storage.ValueInput input) voiddeserialize(net.minecraft.world.level.storage.ValueInput input, String tag) voiddeserializeTank(net.minecraft.world.level.storage.ValueInput input) Read the tank contents from NBT.net.minecraft.world.level.material.FluidGet the fluid that currently occupies this tank, will return null if there is no fluid.intgetTankCapacity(int tank) booleanisEmpty()Check if this tank is empty.booleanisFull()Check if this tank is full; the capacity is reached.protected booleanvoidserialize(net.minecraft.world.level.storage.ValueOutput output) voidvoidserializeTank(net.minecraft.world.level.storage.ValueOutput output) Write the tank contents to NBT.voidsetFluidInTank(int tank, net.neoforged.neoforge.fluids.FluidStack fluidStack) voidsetTankCapacity(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, setValidatorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
isEmptyin 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:
serializein interfacenet.neoforged.neoforge.common.util.ValueIOSerializable- Overrides:
serializein classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
-
serialize
-
deserialize
public void deserialize(net.minecraft.world.level.storage.ValueInput input) - Specified by:
deserializein interfacenet.neoforged.neoforge.common.util.ValueIOSerializable- Overrides:
deserializein 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:
setFluidInTankin interfaceIFluidHandlerMutable
-
setTankCapacity
public void setTankCapacity(int tank, int capacity) - Specified by:
setTankCapacityin interfaceIFluidHandlerCapacity
-
getTankCapacity
public int getTankCapacity(int tank) - Specified by:
getTankCapacityin interfacenet.neoforged.neoforge.fluids.capability.IFluidHandler- Specified by:
getTankCapacityin interfaceIFluidHandlerCapacity- Overrides:
getTankCapacityin classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
-