Class AbstractCapacitorBE

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
top.girlkisser.lazuli.api.block.AbstractEnergyBE
top.girlkisser.lazuli.api.block.AbstractCapacitorBE
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, IEnergyBE, IInventoryBE<net.neoforged.neoforge.items.ItemStackHandler>, ITickableBE

public abstract class AbstractCapacitorBE extends AbstractEnergyBE implements ITickableBE, IInventoryBE<net.neoforged.neoforge.items.ItemStackHandler>
A generic battery block with an inventory to charge items with.
  • 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 capacitor's item handler.

    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

    Fields inherited from interface top.girlkisser.lazuli.api.block.IEnergyBE

    DEFAULT_MAX_ENERGY
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractCapacitorBE(net.minecraft.world.level.block.entity.BlockEntityType<? extends AbstractCapacitorBE> blockEntityType, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
    A generic battery block with an inventory to charge items with.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canDistributeInDirection(net.minecraft.core.Direction direction)
    Get whether the block entity can push energy in the given direction.
    net.neoforged.neoforge.energy.IEnergyStorage
    getEnergyStorage(net.minecraft.core.Direction direction)
    Get the energy storage for a given direction (or no direction).
    net.minecraft.world.item.ItemStack
    Get the item held by the item handler.
    net.neoforged.neoforge.items.ItemStackHandler
    Get the block entity's inventory
    void
    loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
     
    void
    saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
     
    void
    serverTick(net.minecraft.server.level.ServerLevel level)
    Invoked on the server every tick.

    Methods inherited from class top.girlkisser.lazuli.api.block.AbstractEnergyBE

    getEnergyStorage, makeEnergyStorage

    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.IEnergyBE

    distributePower, getEnergyStored, getMaxEnergy, getMaxEnergyExtract, getMaxEnergyReceive

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

    clientTick
  • Field Details

    • itemHandler

      protected final net.neoforged.neoforge.items.ItemStackHandler itemHandler
      The capacitor's item handler.
      TODO: I don't think the capacitor should have an item handler *by default*.
  • Constructor Details

    • AbstractCapacitorBE

      public AbstractCapacitorBE(net.minecraft.world.level.block.entity.BlockEntityType<? extends AbstractCapacitorBE> blockEntityType, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
      A generic battery block with an inventory to charge items with.
      Parameters:
      blockEntityType - The block entity's type.
      pos - The block entity's position.
      blockState - The block entity's state.
  • Method Details

    • getHeldStack

      public net.minecraft.world.item.ItemStack getHeldStack()
      Get the item held by the item handler.
      Returns:
      The item stack.
    • getEnergyStorage

      public net.neoforged.neoforge.energy.IEnergyStorage getEnergyStorage(@Nullable net.minecraft.core.Direction direction)
      Get the energy storage for a given direction (or no direction).
      Parameters:
      direction - The direction, this can be null.
      Returns:
      The energy storage.
    • 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.
    • canDistributeInDirection

      public boolean canDistributeInDirection(net.minecraft.core.Direction direction)
      Description copied from interface: IEnergyBE
      Get whether the block entity can push energy in the given direction.
      Specified by:
      canDistributeInDirection in interface IEnergyBE
      Parameters:
      direction - The direction to check.
      Returns:
      `true` if energy can be pushed in the given direction.
    • serverTick

      public void serverTick(net.minecraft.server.level.ServerLevel level)
      Description copied from interface: ITickableBE
      Invoked on the server every tick.
      Specified by:
      serverTick in interface ITickableBE
      Parameters:
      level - The level.
    • saveAdditional

      public void saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      saveAdditional in class AbstractEnergyBE
    • loadAdditional

      public void loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      loadAdditional in class AbstractEnergyBE