Class EnchantingTableBlockEntityMixin

java.lang.Object
net.minecraft.world.level.block.entity.BlockEntity
johnsmith.enchantingoverhauled.mixin.block.entity.EnchantingTableBlockEntityMixin
All Implemented Interfaces:
TomeStorageAccessor, net.fabricmc.fabric.api.attachment.v1.AttachmentTarget, net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity, net.minecraft.util.debug.DebugValueSource

public abstract class EnchantingTableBlockEntityMixin extends net.minecraft.world.level.block.entity.BlockEntity implements TomeStorageAccessor
Injects tome storage capabilities into the vanilla EnchantingTableBlockEntity. Manages NBT serialization and server-to-client data synchronization.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.fabricmc.fabric.api.attachment.v1.AttachmentTarget

    net.fabricmc.fabric.api.attachment.v1.AttachmentTarget.OnAttachedSet<A>

    Nested classes/interfaces inherited from interface net.minecraft.util.debug.DebugValueSource

    net.minecraft.util.debug.DebugValueSource.Registration, net.minecraft.util.debug.DebugValueSource.ValueGetter<T>
  • Field Summary

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    level, remove, worldPosition

    Fields inherited from interface net.fabricmc.fabric.api.attachment.v1.AttachmentTarget

    NBT_ATTACHMENT_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnchantingTableBlockEntityMixin(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Initializes a new block entity mixin instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.item.ItemStack
    Retrieves the stored tome item stack.
    void
    enchanting_overhauled$setTomeStack(net.minecraft.world.item.ItemStack stack)
    Assigns a new tome item stack.
    @Nullable net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener>
    Generates the network packet required to synchronize the block entity data to the client.
    net.minecraft.nbt.CompoundTag
    getUpdateTag(net.minecraft.core.HolderLookup.Provider registries)
    Constructs the NBT compound tag for the update packet.

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getNameForReporting, getPosFromTag, getType, hasLevel, isRemoved, isValidBlockState, loadAdditional, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, preRemoveSideEffects, problemPath, registerDebugValues, removeComponentsFromTag, saveAdditional, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setLevel, setRemoved, triggerEvent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.fabricmc.fabric.api.attachment.v1.AttachmentTarget

    getAttached, getAttachedOrCreate, getAttachedOrCreate, getAttachedOrElse, getAttachedOrGet, getAttachedOrSet, getAttachedOrThrow, hasAttached, modifyAttached, onAttachedSet, removeAttached, setAttached

    Methods inherited from interface net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity

    getRenderData
  • Constructor Details

    • EnchantingTableBlockEntityMixin

      public EnchantingTableBlockEntityMixin(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Initializes a new block entity mixin instance.
      Parameters:
      type - The block entity type.
      pos - The block position.
      state - The block state.
  • Method Details

    • enchanting_overhauled$getTomeStack

      public net.minecraft.world.item.ItemStack enchanting_overhauled$getTomeStack()
      Retrieves the stored tome item stack.
      Specified by:
      enchanting_overhauled$getTomeStack in interface TomeStorageAccessor
      Returns:
      The stored item stack.
    • enchanting_overhauled$setTomeStack

      public void enchanting_overhauled$setTomeStack(net.minecraft.world.item.ItemStack stack)
      Assigns a new tome item stack. Marks the block entity as changed. Dispatches a block update to synchronize data with the client.
      Specified by:
      enchanting_overhauled$setTomeStack in interface TomeStorageAccessor
      Parameters:
      stack - The item stack to store.
    • getUpdatePacket

      @Nullable public @Nullable net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getUpdatePacket()
      Generates the network packet required to synchronize the block entity data to the client.
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
      Returns:
      The client-bound block entity data packet.
    • getUpdateTag

      public net.minecraft.nbt.CompoundTag getUpdateTag(net.minecraft.core.HolderLookup.Provider registries)
      Constructs the NBT compound tag for the update packet.
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
      Parameters:
      registries - The registry access provider.
      Returns:
      The NBT compound tag containing custom data.