Package org.cyclops.cyclopscore.fluid
Class SingleUseTank
java.lang.Object
net.minecraftforge.fluids.capability.templates.FluidTank
org.cyclops.cyclopscore.fluid.Tank
org.cyclops.cyclopscore.fluid.SingleUseTank
- All Implemented Interfaces:
net.minecraftforge.fluids.capability.IFluidHandler
,net.minecraftforge.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.minecraftforge.fluids.capability.IFluidHandler
net.minecraftforge.fluids.capability.IFluidHandler.FluidAction
-
Field Summary
Fields inherited from class net.minecraftforge.fluids.capability.templates.FluidTank
capacity, fluid, validator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDirtyMarkListener
(IDirtyMarkListener dirtyMarkListener) Add a dirty marking listener.net.minecraftforge.fluids.FluidStack
drain
(int maxDrain, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action) net.minecraftforge.fluids.FluidStack
drain
(net.minecraftforge.fluids.FluidStack resource, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action) int
fill
(net.minecraftforge.fluids.FluidStack resource, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action) net.minecraft.world.level.material.Fluid
Get the accepted fluid for this tank.void
readTankFromNBT
(net.minecraft.nbt.CompoundTag nbt) Read the tank contents from NBT.void
removeDirtyMarkListener
(IDirtyMarkListener dirtyMarkListener) Remove a dirty marking listener.void
reset()
Reset the tank by setting the inner fluid to null.protected void
void
setAcceptedFluid
(net.minecraft.world.level.material.Fluid fluid) Set the accepted fluid for this tank.void
writeTankToNBT
(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, writeToNBT
Methods inherited from class net.minecraftforge.fluids.capability.templates.FluidTank
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.minecraftforge.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
Add a dirty marking listener.- Parameters:
dirtyMarkListener
- The dirty mark listener.
-
removeDirtyMarkListener
Remove a dirty marking listener.- Parameters:
dirtyMarkListener
- The dirty mark listener.
-
fill
public int fill(net.minecraftforge.fluids.FluidStack resource, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action) - Specified by:
fill
in interfacenet.minecraftforge.fluids.capability.IFluidHandler
- Specified by:
fill
in interfacenet.minecraftforge.fluids.IFluidTank
- Overrides:
fill
in classnet.minecraftforge.fluids.capability.templates.FluidTank
-
drain
public net.minecraftforge.fluids.FluidStack drain(int maxDrain, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action) - Specified by:
drain
in interfacenet.minecraftforge.fluids.capability.IFluidHandler
- Specified by:
drain
in interfacenet.minecraftforge.fluids.IFluidTank
- Overrides:
drain
in classnet.minecraftforge.fluids.capability.templates.FluidTank
-
drain
public net.minecraftforge.fluids.FluidStack drain(net.minecraftforge.fluids.FluidStack resource, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action) - Specified by:
drain
in interfacenet.minecraftforge.fluids.capability.IFluidHandler
- Specified by:
drain
in interfacenet.minecraftforge.fluids.IFluidTank
- Overrides:
drain
in classnet.minecraftforge.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:Tank
Write the tank contents to NBT.- Overrides:
writeTankToNBT
in classTank
- Parameters:
nbt
- The NBT tag to write to.
-
readTankFromNBT
public void readTankFromNBT(net.minecraft.nbt.CompoundTag nbt) Description copied from class:Tank
Read the tank contents from NBT.- Overrides:
readTankFromNBT
in classTank
- Parameters:
nbt
- The NBT tag to write from.
-