Package org.cyclops.cyclopscore.fluid
Class Tank
java.lang.Object
net.minecraftforge.fluids.capability.templates.FluidTank
org.cyclops.cyclopscore.fluid.Tank
- All Implemented Interfaces:
net.minecraftforge.fluids.capability.IFluidHandler
,net.minecraftforge.fluids.IFluidTank
,IFluidHandlerCapacity
,IFluidHandlerMutable
- Direct Known Subclasses:
SingleUseTank
public class Tank
extends net.minecraftforge.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.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 TypeMethodDescriptionnet.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.net.minecraftforge.fluids.capability.templates.FluidTank
readFromNBT
(net.minecraft.nbt.CompoundTag nbt) net.minecraftforge.fluids.capability.templates.FluidTank
readFromNBT
(net.minecraft.nbt.CompoundTag data, String tag) void
readTankFromNBT
(net.minecraft.nbt.CompoundTag nbt) Read the tank contents from NBT.protected boolean
void
setFluidInTank
(int tank, net.minecraftforge.fluids.FluidStack fluidStack) void
setTankCapacity
(int tank, int capacity) void
writeTankToNBT
(net.minecraft.nbt.CompoundTag nbt) Write the tank contents to NBT.net.minecraft.nbt.CompoundTag
writeToNBT
(net.minecraft.nbt.CompoundTag nbt) net.minecraft.nbt.CompoundTag
writeToNBT
(net.minecraft.nbt.CompoundTag nbt, String tag) Methods inherited from class net.minecraftforge.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.minecraftforge.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.minecraftforge.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() -
writeToNBT
public net.minecraft.nbt.CompoundTag writeToNBT(net.minecraft.nbt.CompoundTag nbt) - Overrides:
writeToNBT
in classnet.minecraftforge.fluids.capability.templates.FluidTank
-
writeToNBT
-
readFromNBT
public net.minecraftforge.fluids.capability.templates.FluidTank readFromNBT(net.minecraft.nbt.CompoundTag nbt) - Overrides:
readFromNBT
in classnet.minecraftforge.fluids.capability.templates.FluidTank
-
readFromNBT
public net.minecraftforge.fluids.capability.templates.FluidTank readFromNBT(net.minecraft.nbt.CompoundTag data, String tag) -
writeTankToNBT
public void writeTankToNBT(net.minecraft.nbt.CompoundTag nbt) Write the tank contents to NBT.- Parameters:
nbt
- The NBT tag to write to.
-
readTankFromNBT
public void readTankFromNBT(net.minecraft.nbt.CompoundTag nbt) Read the tank contents from NBT.- Parameters:
nbt
- The NBT tag to write from.
-
setFluidInTank
public void setFluidInTank(int tank, net.minecraftforge.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.minecraftforge.fluids.capability.IFluidHandler
- Specified by:
getTankCapacity
in interfaceIFluidHandlerCapacity
- Overrides:
getTankCapacity
in classnet.minecraftforge.fluids.capability.templates.FluidTank
-