Class BlockEntityEnergyBattery
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
org.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon
org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity
org.cyclops.integrateddynamics.core.blockentity.BlockEntityCableConnectable
org.cyclops.integrateddynamics.blockentity.BlockEntityEnergyBattery
- All Implemented Interfaces:
net.neoforged.neoforge.attachment.IAttachmentHolder
,net.neoforged.neoforge.common.extensions.IBlockEntityExtension
,net.neoforged.neoforge.energy.IEnergyStorage
,org.cyclops.cyclopscore.blockentity.IBlockEntityDelayedTickable
,org.cyclops.cyclopscore.persist.IDirtyMarkListener
,org.cyclops.cyclopscore.persist.nbt.INBTProvider
,IEnergyStorageCapacity
public class BlockEntityEnergyBattery
extends BlockEntityCableConnectable
implements IEnergyStorageCapacity
A part entity used to store variables.
Internally, this also acts as an expression cache
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
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 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
ConstructorDescriptionBlockEntityEnergyBattery
(net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
addEnergy
(int energy) protected int
addEnergyFe
(int energy, boolean simulate) boolean
boolean
int
extractEnergy
(int energy, boolean simulate) protected int
static int
getEnergyPerTick
(int capacity) int
int
int
boolean
void
int
receiveEnergy
(int energy, boolean simulate) void
setCapacity
(int capacity) protected void
setEnergy
(int energy) void
setEnergyStored
(int energy) Methods inherited from class org.cyclops.integrateddynamics.core.blockentity.BlockEntityCableConnectable
getCable, getConnected, getNetworkCarrier, onChunkUnloaded, read
Methods inherited from class org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity
onDataPacket
Methods inherited from class org.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon
canInteractWith, getRotation, getUpdateBackoff, getUpdatePacket, getUpdateTag, loadAdditional, onDirty, readGeneratedFieldsFromNBT, saveAdditional, sendUpdate, setUpdateBackoff, shouldSendUpdate, transformFacingForRotation, unsetSendUpdate, writeGeneratedFieldsToNBT, writeToItemStack
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, 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, getExistingData, 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, hasData, removeData, setData
Methods inherited from interface org.cyclops.cyclopscore.blockentity.IBlockEntityDelayedTickable
reduceUpdateBackoff, sendImmediateUpdate
Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onLoad, requestModelDataUpdate
-
Constructor Details
-
BlockEntityEnergyBattery
public BlockEntityEnergyBattery(net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState)
-
-
Method Details
-
getNetworkElementProvider
- Specified by:
getNetworkElementProvider
in classBlockEntityCableConnectable
-
isCreative
public boolean isCreative() -
setEnergyStored
public void setEnergyStored(int energy) -
getEnergyStored
public int getEnergyStored()- Specified by:
getEnergyStored
in interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
getMaxEnergyStored
public int getMaxEnergyStored()- Specified by:
getMaxEnergyStored
in interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
canExtract
public boolean canExtract()- Specified by:
canExtract
in interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
canReceive
public boolean canReceive()- Specified by:
canReceive
in interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
setEnergy
protected void setEnergy(int energy) -
getUpdateBackoffTicks
public int getUpdateBackoffTicks()- Specified by:
getUpdateBackoffTicks
in interfaceorg.cyclops.cyclopscore.blockentity.IBlockEntityDelayedTickable
- Overrides:
getUpdateBackoffTicks
in classorg.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon
-
onUpdateReceived
public void onUpdateReceived()- Overrides:
onUpdateReceived
in classorg.cyclops.cyclopscore.blockentity.CyclopsBlockEntity
-
getEnergyPerTick
public static int getEnergyPerTick(int capacity) -
getEnergyPerTick
protected int getEnergyPerTick() -
receiveEnergy
public int receiveEnergy(int energy, boolean simulate) - Specified by:
receiveEnergy
in interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
extractEnergy
public int extractEnergy(int energy, boolean simulate) - Specified by:
extractEnergy
in interfacenet.neoforged.neoforge.energy.IEnergyStorage
-
addEnergy
protected int addEnergy(int energy) -
addEnergyFe
protected int addEnergyFe(int energy, boolean simulate) -
setCapacity
public void setCapacity(int capacity) - Specified by:
setCapacity
in interfaceIEnergyStorageCapacity
-