Class FabricFluidHolder
java.lang.Object
net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant<FabricFluidHolder>
earth.terrarium.botarium.fabric.fluid.holder.FabricFluidHolder
- All Implemented Interfaces:
FluidHolder,net.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>,net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext.CloseCallback,net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext.OuterCloseCallback
public class FabricFluidHolder
extends net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant<FabricFluidHolder>
implements FluidHolder, net.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
-
Field Summary
Fields inherited from interface earth.terrarium.botarium.common.fluid.base.FluidHolder
CODEC -
Method Summary
Modifier and TypeMethodDescriptionprotected FabricFluidHoldervoiddeserialize(net.minecraft.nbt.CompoundTag compound) Deserializes aFluidHolderfrom a givenCompoundTag.static FabricFluidHolderempty()Returns an empty FluidHolder.longextract(net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant resource, long maxAmount, net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext transaction) longlongnet.minecraft.nbt.CompoundTagnet.minecraft.world.level.material.FluidgetFluid()longnet.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantbooleanisEmpty()booleanbooleanmatches(FluidHolder fluidHolder) Compares theFluidHolderto anotherFluidHolderignoring the amount.static FabricFluidHolderof(FluidHolder fluidHolder) static FabricFluidHolderof(net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant variant, long amount) static FabricFluidHolderof(net.minecraft.world.level.material.Fluid variant, long amount, net.minecraft.nbt.CompoundTag compoundTag) Creates a FluidHolder with the specified Fluid, amount, and CompoundTag.protected voidreadSnapshot(FabricFluidHolder snapshot) net.minecraft.nbt.CompoundTagvoidsetAmount(long amount) Sets the amount of fluid in the holder.voidsetCompound(net.minecraft.nbt.CompoundTag tag) Sets theCompoundTagin the holder.voidsetFluid(net.minecraft.world.level.material.Fluid fluid) Sets theFluidin the holder.net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantMethods inherited from class net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant
afterOuterClose, onClose, onFinalCommit, releaseSnapshot, updateSnapshotsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface earth.terrarium.botarium.common.fluid.base.FluidHolder
copyWithAmount, getFluidHolder, is, is, is, is, writeToBufferMethods inherited from interface net.fabricmc.fabric.api.transfer.v1.storage.StorageView
getUnderlyingView
-
Method Details
-
of
public static FabricFluidHolder of(net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant variant, long amount) -
of
public static FabricFluidHolder of(net.minecraft.world.level.material.Fluid variant, long amount, net.minecraft.nbt.CompoundTag compoundTag) Description copied from interface:FluidHolderCreates a FluidHolder with the specified Fluid, amount, and CompoundTag.- Parameters:
variant- The Fluid to set in the holder.amount- The amount of fluid to set in the holder.compoundTag- The CompoundTag to set in the holder.- Returns:
- The created FluidHolder.
-
of
-
toVariant
public net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant toVariant() -
getFluid
public net.minecraft.world.level.material.Fluid getFluid()- Specified by:
getFluidin interfaceFluidHolder- Returns:
- The
Fluidin the holder.
-
setFluid
public void setFluid(net.minecraft.world.level.material.Fluid fluid) Description copied from interface:FluidHolderSets theFluidin the holder.- Specified by:
setFluidin interfaceFluidHolder- Parameters:
fluid- TheFluidto set in the holder.
-
extract
public long extract(net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant resource, long maxAmount, net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext transaction) - Specified by:
extractin interfacenet.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
-
isResourceBlank
public boolean isResourceBlank()- Specified by:
isResourceBlankin interfacenet.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
-
getResource
public net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant getResource()- Specified by:
getResourcein interfacenet.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
-
getAmount
public long getAmount()- Specified by:
getAmountin interfacenet.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
-
getFluidAmount
public long getFluidAmount()- Specified by:
getFluidAmountin interfaceFluidHolder- Returns:
- The amount of fluid in the holder.
-
getCapacity
public long getCapacity()- Specified by:
getCapacityin interfacenet.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
-
setAmount
public void setAmount(long amount) Description copied from interface:FluidHolderSets the amount of fluid in the holder.- Specified by:
setAmountin interfaceFluidHolder- Parameters:
amount- The amount of fluid to set in the holder.
-
getCompound
public net.minecraft.nbt.CompoundTag getCompound()- Specified by:
getCompoundin interfaceFluidHolder- Returns:
- The
CompoundTagin the holder.
-
setCompound
public void setCompound(net.minecraft.nbt.CompoundTag tag) Description copied from interface:FluidHolderSets theCompoundTagin the holder.- Specified by:
setCompoundin interfaceFluidHolder- Parameters:
tag- TheCompoundTagto set in the holder.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceFluidHolder- Returns:
- True if the holder is empty, false otherwise.
-
matches
Description copied from interface:FluidHolderCompares theFluidHolderto anotherFluidHolderignoring the amount.- Specified by:
matchesin interfaceFluidHolder- Parameters:
fluidHolder- TheFluidHolderto compare to.- Returns:
- True if the given holder is equal to this holder, false otherwise.
-
copyHolder
- Specified by:
copyHolderin interfaceFluidHolder- Returns:
- A copy of the
FluidHolder.
-
serialize
public net.minecraft.nbt.CompoundTag serialize()- Specified by:
serializein interfaceFluidHolder- Returns:
- A serialized version of the
FluidHolderinto aCompoundTag.
-
deserialize
public void deserialize(net.minecraft.nbt.CompoundTag compound) Description copied from interface:FluidHolderDeserializes aFluidHolderfrom a givenCompoundTag.- Specified by:
deserializein interfaceFluidHolder- Parameters:
compound- TheCompoundTagto deserialize from.
-
createSnapshot
- Specified by:
createSnapshotin classnet.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant<FabricFluidHolder>
-
readSnapshot
- Specified by:
readSnapshotin classnet.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant<FabricFluidHolder>
-
empty
Description copied from interface:FluidHolderReturns an empty FluidHolder.- Returns:
- The empty FluidHolder.
-