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>
  • 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: FluidHolder
      Creates 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

      public static FabricFluidHolder of(FluidHolder fluidHolder)
    • toVariant

      public net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant toVariant()
    • getFluid

      public net.minecraft.world.level.material.Fluid getFluid()
      Specified by:
      getFluid in interface FluidHolder
      Returns:
      The Fluid in the holder.
    • setFluid

      public void setFluid(net.minecraft.world.level.material.Fluid fluid)
      Description copied from interface: FluidHolder
      Sets the Fluid in the holder.
      Specified by:
      setFluid in interface FluidHolder
      Parameters:
      fluid - The Fluid to 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:
      extract in interface net.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
    • isResourceBlank

      public boolean isResourceBlank()
      Specified by:
      isResourceBlank in interface net.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:
      getResource in interface net.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
    • getAmount

      public long getAmount()
      Specified by:
      getAmount in interface net.fabricmc.fabric.api.transfer.v1.storage.StorageView<net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant>
    • getFluidAmount

      public long getFluidAmount()
      Specified by:
      getFluidAmount in interface FluidHolder
      Returns:
      The amount of fluid in the holder.
    • getCapacity

      public long getCapacity()
      Specified by:
      getCapacity in interface net.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: FluidHolder
      Sets the amount of fluid in the holder.
      Specified by:
      setAmount in interface FluidHolder
      Parameters:
      amount - The amount of fluid to set in the holder.
    • getCompound

      public net.minecraft.nbt.CompoundTag getCompound()
      Specified by:
      getCompound in interface FluidHolder
      Returns:
      The CompoundTag in the holder.
    • setCompound

      public void setCompound(net.minecraft.nbt.CompoundTag tag)
      Description copied from interface: FluidHolder
      Sets the CompoundTag in the holder.
      Specified by:
      setCompound in interface FluidHolder
      Parameters:
      tag - The CompoundTag to set in the holder.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface FluidHolder
      Returns:
      True if the holder is empty, false otherwise.
    • matches

      public boolean matches(FluidHolder fluidHolder)
      Description copied from interface: FluidHolder
      Compares the FluidHolder to another FluidHolder ignoring the amount.
      Specified by:
      matches in interface FluidHolder
      Parameters:
      fluidHolder - The FluidHolder to compare to.
      Returns:
      True if the given holder is equal to this holder, false otherwise.
    • copyHolder

      public FabricFluidHolder copyHolder()
      Specified by:
      copyHolder in interface FluidHolder
      Returns:
      A copy of the FluidHolder.
    • serialize

      public net.minecraft.nbt.CompoundTag serialize()
      Specified by:
      serialize in interface FluidHolder
      Returns:
      A serialized version of the FluidHolder into a CompoundTag.
    • deserialize

      public void deserialize(net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: FluidHolder
      Deserializes a FluidHolder from a given CompoundTag.
      Specified by:
      deserialize in interface FluidHolder
      Parameters:
      compound - The CompoundTag to deserialize from.
    • createSnapshot

      protected FabricFluidHolder createSnapshot()
      Specified by:
      createSnapshot in class net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant<FabricFluidHolder>
    • readSnapshot

      protected void readSnapshot(FabricFluidHolder snapshot)
      Specified by:
      readSnapshot in class net.fabricmc.fabric.api.transfer.v1.transaction.base.SnapshotParticipant<FabricFluidHolder>
    • empty

      public static FabricFluidHolder empty()
      Description copied from interface: FluidHolder
      Returns an empty FluidHolder.
      Returns:
      The empty FluidHolder.