Class AbstractSingleTankBE

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
top.girlkisser.lazuli.api.block.AbstractSingleTankBE
All Implemented Interfaces:
net.neoforged.neoforge.attachment.IAttachmentHolder, net.neoforged.neoforge.common.extensions.IBlockEntityExtension, IBE, IFluidBE, ISingleTankBE

public class AbstractSingleTankBE extends net.minecraft.world.level.block.entity.BlockEntity implements ISingleTankBE
A block entity with a single tank.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity

    net.minecraft.world.level.block.entity.BlockEntity.DataComponentInput

    Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    net.neoforged.neoforge.attachment.AttachmentHolder.AsField
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final int
    The tank's capacity in mB.
    protected final net.neoforged.neoforge.fluids.capability.templates.FluidTank
    The block entity's fluid tank.

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    level, remove, worldPosition

    Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    ATTACHMENTS_NBT_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractSingleTankBE(net.minecraft.world.level.block.entity.BlockEntityType<?> type, int capacity, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
    A block entity with a single tank.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.neoforged.neoforge.fluids.capability.templates.FluidTank
    Get the block entity's tank.
    protected void
    loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
     
    protected net.neoforged.neoforge.fluids.capability.templates.FluidTank
    Creates the fluid tank for the block entity.
    protected void
    saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
     
    protected boolean
    validate(net.neoforged.neoforge.fluids.FluidStack stack)
    A basic validator for fluid stacks.

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, triggerEvent

    Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachments

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder

    getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData

    Methods inherited from interface top.girlkisser.lazuli.api.block.IBE

    getBlockPos, getBlockState, getLevel, setChanged

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension

    getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate

    Methods inherited from interface top.girlkisser.lazuli.api.block.ISingleTankBE

    getMaxFluidExtract, getMaxFluidReceive, getTankCapacity, tryDistributeFluid
  • Field Details

    • tank

      protected final net.neoforged.neoforge.fluids.capability.templates.FluidTank tank
      The block entity's fluid tank.
    • capacity

      protected final int capacity
      The tank's capacity in mB.
  • Constructor Details

    • AbstractSingleTankBE

      public AbstractSingleTankBE(net.minecraft.world.level.block.entity.BlockEntityType<?> type, int capacity, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
      A block entity with a single tank.
      Parameters:
      type - The block entity's type.
      capacity - The tank's capacity in mB.
      pos - The block entity's position.
      blockState - The block entity's block state.
  • Method Details

    • validate

      protected boolean validate(net.neoforged.neoforge.fluids.FluidStack stack)
      A basic validator for fluid stacks. If makeFluidTank() is overridden, this method may do nothing.
      Parameters:
      stack - The stack to validate.
      Returns:
      Whether the stack is valid for this tank.
    • makeFluidTank

      protected net.neoforged.neoforge.fluids.capability.templates.FluidTank makeFluidTank()
      Creates the fluid tank for the block entity.
      Returns:
      The tank.
    • getTank

      public net.neoforged.neoforge.fluids.capability.templates.FluidTank getTank()
      Description copied from interface: ISingleTankBE
      Get the block entity's tank.
      Specified by:
      getTank in interface ISingleTankBE
      Returns:
      The tank.
    • saveAdditional

      protected void saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      saveAdditional in class net.minecraft.world.level.block.entity.BlockEntity
    • loadAdditional

      protected void loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      loadAdditional in class net.minecraft.world.level.block.entity.BlockEntity