Package org.cyclops.cyclopscore.fluid
Class SingleUseTank
java.lang.Object
net.neoforged.neoforge.fluids.capability.templates.FluidTank
org.cyclops.cyclopscore.fluid.Tank
org.cyclops.cyclopscore.fluid.SingleUseTank
- All Implemented Interfaces:
net.neoforged.neoforge.common.util.ValueIOSerializable,net.neoforged.neoforge.fluids.capability.IFluidHandler,net.neoforged.neoforge.fluids.IFluidTank,IFluidHandlerCapacity,IFluidHandlerMutable
A simple tank that can accept and drain fluids until the capacity is reached.
Only one fluid can be accepted, which must be specified with
setAcceptedFluid(Fluid).
Based on the Buildcraft SingleUseTank.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.neoforged.neoforge.fluids.capability.IFluidHandler
net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction -
Field Summary
FieldsFields inherited from class net.neoforged.neoforge.fluids.capability.templates.FluidTank
capacity, fluid, validator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDirtyMarkListener(org.cyclops.cyclopscore.persist.IDirtyMarkListener dirtyMarkListener) Add a dirty marking listener.voiddeserializeTank(net.minecraft.world.level.storage.ValueInput input) Read the tank contents from NBT.net.neoforged.neoforge.fluids.FluidStackdrain(int maxDrain, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) net.neoforged.neoforge.fluids.FluidStackdrain(net.neoforged.neoforge.fluids.FluidStack resource, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) intfill(net.neoforged.neoforge.fluids.FluidStack resource, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) net.minecraft.world.level.material.FluidGet the accepted fluid for this tank.voidremoveDirtyMarkListener(org.cyclops.cyclopscore.persist.IDirtyMarkListener dirtyMarkListener) Remove a dirty marking listener.voidreset()Reset the tank by setting the inner fluid to null.protected voidvoidserializeTank(net.minecraft.world.level.storage.ValueOutput output) Write the tank contents to NBT.voidsetAcceptedFluid(net.minecraft.world.level.material.Fluid fluid) Set the accepted fluid for this tank.Methods inherited from class org.cyclops.cyclopscore.fluid.Tank
deserialize, deserialize, getFluidType, getTankCapacity, isEmpty, isFull, replaceInnerFluid, serialize, serialize, setFluidInTank, setTankCapacityMethods inherited from class net.neoforged.neoforge.fluids.capability.templates.FluidTank
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
getFluidInTank, getTanks, isFluidValid
-
Field Details
-
NBT_ACCEPTED_FLUID
The NBT name for the fluid tank.- See Also:
-
-
Constructor Details
-
SingleUseTank
public SingleUseTank(int capacity) Make a new tank instance.- Parameters:
capacity- The capacity (mB) for the tank.
-
-
Method Details
-
addDirtyMarkListener
public void addDirtyMarkListener(org.cyclops.cyclopscore.persist.IDirtyMarkListener dirtyMarkListener) Add a dirty marking listener.- Parameters:
dirtyMarkListener- The dirty mark listener.
-
removeDirtyMarkListener
public void removeDirtyMarkListener(org.cyclops.cyclopscore.persist.IDirtyMarkListener dirtyMarkListener) Remove a dirty marking listener.- Parameters:
dirtyMarkListener- The dirty mark listener.
-
fill
public int fill(net.neoforged.neoforge.fluids.FluidStack resource, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) - Specified by:
fillin interfacenet.neoforged.neoforge.fluids.capability.IFluidHandler- Specified by:
fillin interfacenet.neoforged.neoforge.fluids.IFluidTank- Overrides:
fillin classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
-
drain
public net.neoforged.neoforge.fluids.FluidStack drain(int maxDrain, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) - Specified by:
drainin interfacenet.neoforged.neoforge.fluids.capability.IFluidHandler- Specified by:
drainin interfacenet.neoforged.neoforge.fluids.IFluidTank- Overrides:
drainin classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
-
drain
public net.neoforged.neoforge.fluids.FluidStack drain(net.neoforged.neoforge.fluids.FluidStack resource, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) - Specified by:
drainin interfacenet.neoforged.neoforge.fluids.capability.IFluidHandler- Specified by:
drainin interfacenet.neoforged.neoforge.fluids.IFluidTank- Overrides:
drainin classnet.neoforged.neoforge.fluids.capability.templates.FluidTank
-
sendUpdate
protected void sendUpdate() -
reset
public void reset()Reset the tank by setting the inner fluid to null. -
setAcceptedFluid
public void setAcceptedFluid(net.minecraft.world.level.material.Fluid fluid) Set the accepted fluid for this tank.- Parameters:
fluid- The accepted fluid
-
getAcceptedFluid
public net.minecraft.world.level.material.Fluid getAcceptedFluid()Get the accepted fluid for this tank.- Returns:
- The accepted fluid.
-
serializeTank
public void serializeTank(net.minecraft.world.level.storage.ValueOutput output) Description copied from class:TankWrite the tank contents to NBT.- Overrides:
serializeTankin classTank- Parameters:
output- The value tag to write to.
-
deserializeTank
public void deserializeTank(net.minecraft.world.level.storage.ValueInput input) Description copied from class:TankRead the tank contents from NBT.- Overrides:
deserializeTankin classTank- Parameters:
input- The value to write from.
-