Class AbstractSingleTankAndInventoryBE

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
top.girlkisser.lazuli.api.block.AbstractSingleTankAndInventoryBE
All Implemented Interfaces:
net.minecraft.world.Clearable, net.minecraft.world.Container, net.minecraft.world.inventory.StackedContentsCompatible, net.minecraft.world.WorldlyContainer, net.neoforged.neoforge.attachment.IAttachmentHolder, net.neoforged.neoforge.common.extensions.IBlockEntityExtension, IBE, IFluidBE, IInventoryBE<net.neoforged.neoforge.items.ItemStackHandler>, ISingleTankBE

public abstract class AbstractSingleTankAndInventoryBE extends net.minecraft.world.level.block.entity.BlockEntity implements ISingleTankBE, IInventoryBE<net.neoforged.neoforge.items.ItemStackHandler>
A block entity implementing both ISingleTankBE and IInventoryBE.
  • 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 net.neoforged.neoforge.items.ItemStackHandler
    The block entity's inventory
    protected final int
    The amount of slots the inventory has.
    protected final net.neoforged.neoforge.fluids.capability.templates.FluidTank
    The block entity's fluid tank.
    protected final int
    The tank's capacity in mB.

    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

    Fields inherited from interface net.minecraft.world.Container

    DEFAULT_DISTANCE_BUFFER
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractSingleTankAndInventoryBE(net.minecraft.world.level.block.entity.BlockEntityType<?> type, int tankCapacity, int slots, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
    A block entity implementing both ISingleTankBE and IInventoryBE.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.neoforged.neoforge.items.ItemStackHandler
    Get the block entity's inventory
    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 net.neoforged.neoforge.items.ItemStackHandler
    Creates the item stack handler for the block entity.
    protected void
    saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
     
    protected boolean
    validateFluidStack(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.minecraft.world.Container

    canPlaceItem, canTakeItem, countItem, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, setChanged, startOpen, stopOpen

    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.
    • tankCapacity

      protected final int tankCapacity
      The tank's capacity in mB.
    • inventory

      protected final net.neoforged.neoforge.items.ItemStackHandler inventory
      The block entity's inventory
    • slots

      protected final int slots
      The amount of slots the inventory has.
  • Constructor Details

    • AbstractSingleTankAndInventoryBE

      public AbstractSingleTankAndInventoryBE(net.minecraft.world.level.block.entity.BlockEntityType<?> type, int tankCapacity, int slots, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
      A block entity implementing both ISingleTankBE and IInventoryBE.
      Parameters:
      type - The block entity's type.
      tankCapacity - The tank's capacity in mB.
      slots - The amount of inventory slots.
      pos - The block entity's position.
      blockState - The block entity's block state.
  • Method Details

    • validateFluidStack

      protected boolean validateFluidStack(net.neoforged.neoforge.fluids.FluidStack stack)
      A basic validator for fluid stacks. If AbstractSingleTankBE.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.
    • makeItemStackHandler

      protected net.neoforged.neoforge.items.ItemStackHandler makeItemStackHandler()
      Creates the item stack handler for the block entity.
      Returns:
      Any ItemStackHandler for the inventory.
    • 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.
    • getInventory

      public net.neoforged.neoforge.items.ItemStackHandler getInventory()
      Description copied from interface: IInventoryBE
      Get the block entity's inventory
      Specified by:
      getInventory in interface IInventoryBE<net.neoforged.neoforge.items.ItemStackHandler>
      Returns:
      The inventory.
    • 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