Class AbstractDiskContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>

java.lang.Object
net.minecraft.world.level.block.entity.BlockEntity
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>
  • Field Details

  • 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 class AbstractNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
    • setFilters

      protected abstract void setFilters(Set<ResourceKey> filters)
    • setNormalizer

      protected abstract void setNormalizer(UnaryOperator<ResourceKey> normalizer)
    • 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 class AbstractBaseNetworkNodeContainerBlockEntity<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 class net.minecraft.world.level.block.entity.BlockEntity
    • activenessChanged

      public void activenessChanged(boolean newActive)
      Overrides:
      activenessChanged in class AbstractBaseNetworkNodeContainerBlockEntity<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 class AbstractBaseNetworkNodeContainerBlockEntity<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 interface ConfigurationCardTarget
      Overrides:
      readConfiguration in class AbstractBaseNetworkNodeContainerBlockEntity<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 class AbstractBaseNetworkNodeContainerBlockEntity<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 interface ConfigurationCardTarget
      Overrides:
      writeConfiguration in class AbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>
    • getDiskInventory

      public FilteredContainer getDiskInventory()
    • onClientDriveStateUpdated

      protected void onClientDriveStateUpdated()
    • getUpdatePacket

      public net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getUpdatePacket()
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdateTag

      public net.minecraft.nbt.CompoundTag getUpdateTag(net.minecraft.core.HolderLookup.Provider provider)
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
    • getDrops

      public net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getDrops()
      Specified by:
      getDrops in interface BlockEntityWithDrops
    • getMenuData

      public ResourceContainerData getMenuData()
      Specified by:
      getMenuData in interface ExtendedMenuProvider<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 interface ExtendedMenuProvider<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 class AbstractBaseNetworkNodeContainerBlockEntity<T extends com.refinedmods.refinedstorage.api.network.impl.node.AbstractStorageContainerNetworkNode>