Record Class UnlimitedFluidContainer
java.lang.Object
java.lang.Record
earth.terrarium.botarium.common.fluid.impl.UnlimitedFluidContainer
- All Implemented Interfaces:
FluidContainer,Serializable,Updatable,net.minecraft.world.Clearable
public record UnlimitedFluidContainer(net.minecraft.world.level.material.Fluid fluidType)
extends Record
implements FluidContainer, Updatable
-
Constructor Summary
ConstructorsConstructorDescriptionUnlimitedFluidContainer(net.minecraft.world.level.material.Fluid fluidType) Creates an instance of aUnlimitedFluidContainerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidcopy()voiddeserialize(net.minecraft.nbt.CompoundTag nbt) Deserializes the information of an object from aCompoundTag.final booleanIndicates whether some other object is "equal to" this one.extractFluid(FluidHolder fluid, boolean simulate) Extracts aFluidHolderfrom the container.longextractFromSlot(FluidHolder fluidHolder, FluidHolder toInsert, Runnable snapshot) Extracts a fluid from oneFluidHolderinto another.net.minecraft.world.level.material.FluidReturns the value of thefluidTyperecord component.voidfromContainer(FluidContainer container) Sets the container to the same values as the given container.intgetSize()longgetTankCapacity(int tankSlot) final inthashCode()Returns a hash code value for this object.longinsertFluid(FluidHolder fluid, boolean simulate) Inserts aFluidHolderinto the container.booleanisEmpty()net.minecraft.nbt.CompoundTagserialize(net.minecraft.nbt.CompoundTag nbt) Serializes the information of an object to aCompoundTag.voidsetFluid(int slot, FluidHolder fluid) Sets a givenFluidHolderto a slot in the container.final StringtoString()Returns a string representation of this record class.voidupdate()Called when the operation has been completed and the data has been updated.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface earth.terrarium.botarium.common.fluid.base.FluidContainer
getFirstFluid, internalExtract, internalInsert, isFluidValid, readSnapshot
-
Constructor Details
-
UnlimitedFluidContainer
public UnlimitedFluidContainer(net.minecraft.world.level.material.Fluid fluidType) Creates an instance of aUnlimitedFluidContainerrecord class.- Parameters:
fluidType- the value for thefluidTyperecord component
-
-
Method Details
-
insertFluid
Description copied from interface:FluidContainerInserts aFluidHolderinto the container.- Specified by:
insertFluidin interfaceFluidContainer- Parameters:
fluid- TheFluidHolderto be inserted into the container.simulate- If true, the container will not be modified.- Returns:
- The amount of fluid that was added to the container.
-
extractFluid
Description copied from interface:FluidContainerExtracts aFluidHolderfrom the container.- Specified by:
extractFluidin interfaceFluidContainer- Parameters:
fluid- TheFluidHolderto be extracted from the container.simulate- If true, the container will not be modified.- Returns:
- The
FluidHolderthat was extracted from the container.
-
setFluid
Description copied from interface:FluidContainerSets a givenFluidHolderto a slot in the container.- Specified by:
setFluidin interfaceFluidContainer- Parameters:
slot- The slot to set the fluid in.fluid- TheFluidHolderto set in the slot.
-
getFluids
- Specified by:
getFluidsin interfaceFluidContainer- Returns:
- A
ListofFluidHolderin the container.
-
getSize
public int getSize()- Specified by:
getSizein interfaceFluidContainer- Returns:
- The amount of slots in the container.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceFluidContainer- Returns:
- Whether or not the container is empty.
-
copy
- Specified by:
copyin interfaceFluidContainer- Returns:
- A copy of the container.
-
getTankCapacity
public long getTankCapacity(int tankSlot) - Specified by:
getTankCapacityin interfaceFluidContainer- Parameters:
tankSlot- The slot to get the capacity of.- Returns:
- The capacity of the given slot.
-
fromContainer
Description copied from interface:FluidContainerSets the container to the same values as the given container.- Specified by:
fromContainerin interfaceFluidContainer- Parameters:
container- The container to copy the fluids from.
-
extractFromSlot
Description copied from interface:FluidContainerExtracts a fluid from oneFluidHolderinto another.- Specified by:
extractFromSlotin interfaceFluidContainer- Parameters:
fluidHolder- TheFluidHolderto extract from.toInsert- TheFluidHolderto insert into. With amount clamped between 0-fluid.getFluidAmount().snapshot- A runnable that will be called before the extraction happens.- Returns:
- The amount of fluid that was extracted.
-
allowsInsertion
public boolean allowsInsertion()- Specified by:
allowsInsertionin interfaceFluidContainer- Returns:
- Whether can be inserted into.
-
allowsExtraction
public boolean allowsExtraction()- Specified by:
allowsExtractionin interfaceFluidContainer- Returns:
- Whether can be extracted from.
-
createSnapshot
- Specified by:
createSnapshotin interfaceFluidContainer- Returns:
- A
FluidSnapshotof the given state of theFluidContainer.
-
deserialize
public void deserialize(net.minecraft.nbt.CompoundTag nbt) Description copied from interface:SerializableDeserializes the information of an object from aCompoundTag.- Specified by:
deserializein interfaceSerializable- Parameters:
nbt- TheCompoundTagto deserialize from.
-
serialize
public net.minecraft.nbt.CompoundTag serialize(net.minecraft.nbt.CompoundTag nbt) Description copied from interface:SerializableSerializes the information of an object to aCompoundTag.- Specified by:
serializein interfaceSerializable- Parameters:
nbt- TheCompoundTagto serialize to.- Returns:
- The
CompoundTagthat was passed in but with the information of the object serialized added to it.
-
update
public void update()Description copied from interface:UpdatableCalled when the operation has been completed and the data has been updated. -
clearContent
public void clearContent()- Specified by:
clearContentin interfacenet.minecraft.world.Clearable
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
fluidType
public net.minecraft.world.level.material.Fluid fluidType()Returns the value of thefluidTyperecord component.- Returns:
- the value of the
fluidTyperecord component
-