Class AbstractDiskContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
java.lang.Object
net.minecraft.world.level.block.entity.BlockEntity
com.refinedmods.refinedstorage.common.api.support.network.AbstractNetworkNodeContainerBlockEntity<T>
com.refinedmods.refinedstorage.common.support.network.AbstractBaseNetworkNodeContainerBlockEntity<T>
com.refinedmods.refinedstorage.common.storage.AbstractDiskContainerBlockEntity<T>
- All Implemented Interfaces:
ConfigurationCardTarget
,NetworkItemTargetBlockEntity
,BlockEntityWithDrops
,ExtendedMenuProvider<ResourceContainerData>
,NetworkNodeExtendedMenuProvider<ResourceContainerData>
,NetworkNodeMenuProvider
,PlayerAwareBlockEntity
,net.minecraft.world.inventory.MenuConstructor
,net.minecraft.world.MenuProvider
,net.minecraft.world.Nameable
- Direct Known Subclasses:
AbstractDiskDriveBlockEntity
,AbstractDiskInterfaceBlockEntity
public abstract class AbstractDiskContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
extends AbstractBaseNetworkNodeContainerBlockEntity<T>
implements BlockEntityWithDrops, NetworkNodeExtendedMenuProvider<ResourceContainerData>
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BlockEntity.DataComponentInput
-
Field Summary
Modifier and TypeFieldDescriptionprotected final DiskInventory
protected Disk[]
protected final FilterWithFuzzyMode
Fields inherited from class com.refinedmods.refinedstorage.common.support.network.AbstractBaseNetworkNodeContainerBlockEntity
ticker
Fields inherited from class com.refinedmods.refinedstorage.common.api.support.network.AbstractNetworkNodeContainerBlockEntity
containers, mainNetworkNode
Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPosition
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractDiskContainerBlockEntity
(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, T node) -
Method Summary
Modifier and TypeMethodDescriptionvoid
activenessChanged
(boolean newActive) protected void
protected boolean
doesBlockStateChangeWarrantNetworkNodeUpdate
(net.minecraft.world.level.block.state.BlockState oldBlockState, net.minecraft.world.level.block.state.BlockState newBlockState) static net.minecraft.world.item.Item
getDisk
(net.minecraft.nbt.CompoundTag tag, int slot, net.minecraft.core.HolderLookup.Provider provider) net.minecraft.core.NonNullList
<net.minecraft.world.item.ItemStack> getDrops()
net.minecraft.network.codec.StreamEncoder
<net.minecraft.network.RegistryFriendlyByteBuf, ResourceContainerData> net.minecraft.network.protocol.Packet
<net.minecraft.network.protocol.game.ClientGamePacketListener> net.minecraft.nbt.CompoundTag
getUpdateTag
(net.minecraft.core.HolderLookup.Provider provider) void
loadAdditional
(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) protected void
void
readConfiguration
(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) void
saveAdditional
(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) void
When loading a disk drive in a normal flow it is: #load(CompoundTag) -> #setLevel(Level).protected abstract void
setFilters
(Set<ResourceKey> filters) void
setLevel
(net.minecraft.world.level.Level level) protected abstract void
setNormalizer
(UnaryOperator<ResourceKey> normalizer) void
writeConfiguration
(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) Methods inherited from class com.refinedmods.refinedstorage.common.support.network.AbstractBaseNetworkNodeContainerBlockEntity
applyImplicitComponents, calculateActive, collectImplicitComponents, createMainContainer, doWork, getCustomName, getDisplayName, getFakePlayer, getNetworkForItem, getRedstoneMode, hasRedstoneMode, initialize, initialize, isPlacedBy, overrideName, setBlockState, setCustomName, setPlacedBy, setRedstoneMode, updateActiveness
Methods inherited from class com.refinedmods.refinedstorage.common.api.support.network.AbstractNetworkNodeContainerBlockEntity
clearRemoved, createContainerProvider, getContainerProvider, setRemoved
Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, collectComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPosFromTag, getType, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setChanged, setComponents, triggerEvent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.refinedmods.refinedstorage.common.api.configurationcard.ConfigurationCardTarget
addUpgrade, getUpgrades
Methods inherited from interface net.minecraft.world.inventory.MenuConstructor
createMenu
Methods inherited from interface net.minecraft.world.MenuProvider
getDisplayName
Methods inherited from interface net.minecraft.world.Nameable
getName, hasCustomName
Methods inherited from interface com.refinedmods.refinedstorage.common.support.containermenu.NetworkNodeMenuProvider
canOpen, getContainerProvider
-
Field Details
-
filter
-
diskInventory
-
disks
-
-
Constructor Details
-
AbstractDiskContainerBlockEntity
protected AbstractDiskContainerBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, T node)
-
-
Method Details
-
containerInitialized
protected void containerInitialized()- Overrides:
containerInitialized
in classAbstractNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
setFilters
-
setNormalizer
-
getDisk
@Nullable public static net.minecraft.world.item.Item getDisk(net.minecraft.nbt.CompoundTag tag, int slot, net.minecraft.core.HolderLookup.Provider provider) -
setLevel
public void setLevel(net.minecraft.world.level.Level level) - Overrides:
setLevel
in classAbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
setChanged
public void setChanged()When loading a disk drive in a normal flow it is: #load(CompoundTag) -> #setLevel(Level). Network initialization happens in #setLevel(Level). Loading data before network initialization ensures that all nbt is present (and thus disks are available). However, when we place a block entity with nbt, the flow is different: #setLevel(Level) -> #load(CompoundTag) -> #setChanged(). #setLevel(Level) is called first (before #load(CompoundTag)) and initialization will happen BEFORE we load the components! That's why we need to override #setChanged() here, to ensure that the network and disks are still initialized correctly in that case.- Overrides:
setChanged
in classnet.minecraft.world.level.block.entity.BlockEntity
-
activenessChanged
public void activenessChanged(boolean newActive) - Overrides:
activenessChanged
in classAbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
loadAdditional
public void loadAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) - Overrides:
loadAdditional
in classAbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
readConfiguration
public void readConfiguration(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) - Specified by:
readConfiguration
in interfaceConfigurationCardTarget
- Overrides:
readConfiguration
in classAbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
saveAdditional
public void saveAdditional(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) - Overrides:
saveAdditional
in classAbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
writeConfiguration
public void writeConfiguration(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider) - Specified by:
writeConfiguration
in interfaceConfigurationCardTarget
- Overrides:
writeConfiguration
in classAbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
getDiskInventory
-
onClientDriveStateUpdated
protected void onClientDriveStateUpdated() -
getUpdatePacket
public net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getUpdatePacket()- Overrides:
getUpdatePacket
in classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdateTag
public net.minecraft.nbt.CompoundTag getUpdateTag(net.minecraft.core.HolderLookup.Provider provider) - Overrides:
getUpdateTag
in classnet.minecraft.world.level.block.entity.BlockEntity
-
getDrops
public net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getDrops()- Specified by:
getDrops
in interfaceBlockEntityWithDrops
-
getMenuData
- Specified by:
getMenuData
in interfaceExtendedMenuProvider<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
getMenuCodec
public net.minecraft.network.codec.StreamEncoder<net.minecraft.network.RegistryFriendlyByteBuf,ResourceContainerData> getMenuCodec()- Specified by:
getMenuCodec
in interfaceExtendedMenuProvider<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-
doesBlockStateChangeWarrantNetworkNodeUpdate
protected boolean doesBlockStateChangeWarrantNetworkNodeUpdate(net.minecraft.world.level.block.state.BlockState oldBlockState, net.minecraft.world.level.block.state.BlockState newBlockState) - Overrides:
doesBlockStateChangeWarrantNetworkNodeUpdate
in classAbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
-