Package top.girlkisser.lazuli.api.block
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.DataComponentInputNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
net.neoforged.neoforge.attachment.AttachmentHolder.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intThe tank's capacity in mB.protected final net.neoforged.neoforge.fluids.capability.templates.FluidTankThe block entity's fluid tank.Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSingleTankBE(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 TypeMethodDescriptionnet.neoforged.neoforge.fluids.capability.templates.FluidTankgetTank()Get the block entity's tank.protected voidloadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) protected net.neoforged.neoforge.fluids.capability.templates.FluidTankCreates the fluid tank for the block entity.protected voidsaveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) protected booleanvalidate(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, 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.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.ISingleTankBE
getMaxFluidExtract, getMaxFluidReceive, getTankCapacity, tryDistributeFluid
-
Field Details
-
tank
protected final net.neoforged.neoforge.fluids.capability.templates.FluidTank tankThe block entity's fluid tank. -
capacity
protected final int capacityThe 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. IfmakeFluidTank()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:ISingleTankBEGet the block entity's tank.- Specified by:
getTankin interfaceISingleTankBE- Returns:
- The tank.
-
saveAdditional
protected void saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) - Overrides:
saveAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-
loadAdditional
protected void loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider registries) - Overrides:
loadAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-