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.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.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.voidreadTankFromNBT(net.minecraft.nbt.CompoundTag nbt) Read the tank contents from NBT.voidremoveDirtyMarkListener(org.cyclops.cyclopscore.persist.IDirtyMarkListener dirtyMarkListener) Remove a dirty marking listener.voidreset()Reset the tank by setting the inner fluid to null.protected voidvoidsetAcceptedFluid(net.minecraft.world.level.material.Fluid fluid) Set the accepted fluid for this tank.voidwriteTankToNBT(net.minecraft.nbt.CompoundTag nbt) Write the tank contents to NBT.Methods inherited from class org.cyclops.cyclopscore.fluid.Tank
getFluidType, getTankCapacity, isEmpty, isFull, readFromNBT, readFromNBT, replaceInnerFluid, setFluidInTank, setTankCapacity, writeToNBT, writeToNBTMethods 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.
-
writeTankToNBT
public void writeTankToNBT(net.minecraft.nbt.CompoundTag nbt) Description copied from class:TankWrite the tank contents to NBT.- Overrides:
writeTankToNBTin classTank- Parameters:
nbt- The NBT tag to write to.
-
readTankFromNBT
public void readTankFromNBT(net.minecraft.nbt.CompoundTag nbt) Description copied from class:TankRead the tank contents from NBT.- Overrides:
readTankFromNBTin classTank- Parameters:
nbt- The NBT tag to write from.
-