Package top.girlkisser.lazuli.api.block
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.DataComponentInputNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
net.neoforged.neoforge.attachment.AttachmentHolder.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final net.neoforged.neoforge.items.ItemStackHandlerThe capacitor's item handler.Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFERFields inherited from interface top.girlkisser.lazuli.api.block.IEnergyBE
DEFAULT_MAX_ENERGY -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCapacitorBE(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 TypeMethodDescriptionbooleancanDistributeInDirection(net.minecraft.core.Direction direction) Get whether the block entity can push energy in the given direction.net.neoforged.neoforge.energy.IEnergyStoragegetEnergyStorage(net.minecraft.core.Direction direction) Get the energy storage for a given direction (or no direction).net.minecraft.world.item.ItemStackGet the item held by the item handler.net.neoforged.neoforge.items.ItemStackHandlerGet the block entity's inventoryvoidloadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) voidsaveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) voidserverTick(net.minecraft.server.level.ServerLevel level) Invoked on the server every tick.Methods inherited from class top.girlkisser.lazuli.api.block.AbstractEnergyBE
getEnergyStorage, makeEnergyStorageMethods 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, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.Container
canPlaceItem, canTakeItem, countItem, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, setChanged, startOpen, stopOpenMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setDataMethods inherited from interface top.girlkisser.lazuli.api.block.IBE
getBlockPos, getBlockState, getLevel, setChangedMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface top.girlkisser.lazuli.api.block.IEnergyBE
distributePower, getEnergyStored, getMaxEnergy, getMaxEnergyExtract, getMaxEnergyReceiveMethods inherited from interface top.girlkisser.lazuli.api.block.IInventoryBE
canEjectSlot, canPlaceItemThroughFace, canTakeItemThroughFace, clearContent, fillStackedContents, getContainerSize, getEjectDirection, getFirstStackIndex, getInventory, getItem, getRandomUsedSlot, getRandomUsedSlot, getSlotsForFace, giveItem, isEmpty, isInventoryFull, removeItem, removeItemNoUpdate, setItem, shouldEjectItems, stillValidMethods inherited from interface top.girlkisser.lazuli.api.block.ITickableBE
clientTick
-
Field Details
-
itemHandler
protected final net.neoforged.neoforge.items.ItemStackHandler itemHandlerThe 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:IInventoryBEGet the block entity's inventory- Specified by:
getInventoryin interfaceIInventoryBE<net.neoforged.neoforge.items.ItemStackHandler>- Returns:
- The inventory.
-
canDistributeInDirection
public boolean canDistributeInDirection(net.minecraft.core.Direction direction) Description copied from interface:IEnergyBEGet whether the block entity can push energy in the given direction.- Specified by:
canDistributeInDirectionin interfaceIEnergyBE- 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:ITickableBEInvoked on the server every tick.- Specified by:
serverTickin interfaceITickableBE- Parameters:
level- The level.
-
saveAdditional
public void saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) - Overrides:
saveAdditionalin classAbstractEnergyBE
-
loadAdditional
public void loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) - Overrides:
loadAdditionalin classAbstractEnergyBE
-