Class MobSpawnerBlockEntity

java.lang.Object
net.minecraft.block.entity.BlockEntity
net.minecraft.block.entity.MobSpawnerBlockEntity

public class MobSpawnerBlockEntity extends BlockEntity
Mappings:
Namespace Name
official daw
intermediary net/minecraft/class_2636
named net/minecraft/block/entity/MobSpawnerBlockEntity
  • Field Details

    • logic

      private final MobSpawnerLogic logic
      Mappings:
      Namespace Name Mixin selector
      official a Ldaw;a:Lclm;
      intermediary field_12114 Lnet/minecraft/class_2636;field_12114:Lnet/minecraft/class_1917;
      named logic Lnet/minecraft/block/entity/MobSpawnerBlockEntity;logic:Lnet/minecraft/world/MobSpawnerLogic;
  • Constructor Details

    • MobSpawnerBlockEntity

      public MobSpawnerBlockEntity(BlockPos pos, BlockState state)
      Mappings:
      Namespace Name Mixin selector
      official <init> Ldaw;<init>(Lgu;Ldby;)V
      intermediary <init> Lnet/minecraft/class_2636;<init>(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)V
      named <init> Lnet/minecraft/block/entity/MobSpawnerBlockEntity;<init>(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V
  • Method Details

    • readNbt

      public void readNbt(NbtCompound nbt)
      Reads data from nbt. Subclasses should override this if they store a persistent data.

      NBT is a storage format; therefore, a data from NBT is loaded to a block entity instance's fields, which are used for other operations instead of the NBT. The data is written back to NBT when saving the block entity.

      nbt might not have all expected keys, or might have a key whose value does not meet the requirement (such as the type or the range). This method should fall back to a reasonable default value instead of throwing an exception.

      Overrides:
      readNbt in class BlockEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lczk;a(Lqr;)V
      intermediary method_11014 Lnet/minecraft/class_2586;method_11014(Lnet/minecraft/class_2487;)V
      named readNbt Lnet/minecraft/block/entity/BlockEntity;readNbt(Lnet/minecraft/nbt/NbtCompound;)V
    • writeNbt

      protected void writeNbt(NbtCompound nbt)
      Writes data to nbt. Subclasses should override this if they store a persistent data.

      NBT is a storage format; therefore, a data from NBT is loaded to a block entity instance's fields, which are used for other operations instead of the NBT. The data is written back to NBT when saving the block entity.

      Overrides:
      writeNbt in class BlockEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lczk;b(Lqr;)V
      intermediary method_11007 Lnet/minecraft/class_2586;method_11007(Lnet/minecraft/class_2487;)V
      named writeNbt Lnet/minecraft/block/entity/BlockEntity;writeNbt(Lnet/minecraft/nbt/NbtCompound;)V
    • clientTick

      public static void clientTick(World world, BlockPos pos, BlockState state, MobSpawnerBlockEntity blockEntity)
      Mappings:
      Namespace Name Mixin selector
      official a Ldaw;a(Lcmk;Lgu;Ldby;Ldaw;)V
      intermediary method_31696 Lnet/minecraft/class_2636;method_31696(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_2636;)V
      named clientTick Lnet/minecraft/block/entity/MobSpawnerBlockEntity;clientTick(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/block/entity/MobSpawnerBlockEntity;)V
    • serverTick

      public static void serverTick(World world, BlockPos pos, BlockState state, MobSpawnerBlockEntity blockEntity)
      Mappings:
      Namespace Name Mixin selector
      official b Ldaw;b(Lcmk;Lgu;Ldby;Ldaw;)V
      intermediary method_31697 Lnet/minecraft/class_2636;method_31697(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_2636;)V
      named serverTick Lnet/minecraft/block/entity/MobSpawnerBlockEntity;serverTick(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/block/entity/MobSpawnerBlockEntity;)V
    • toUpdatePacket

      public BlockEntityUpdateS2CPacket toUpdatePacket()
      Description copied from class: BlockEntity
      Returns the packet to send to nearby players when the block entity's observable state changes, or null to not send the packet.

      If the data returned by initial chunk data is suitable for updates, the following shortcut can be used to create an update packet: BlockEntityUpdateS2CPacket.create(this). The NBT will be passed to BlockEntity.readNbt(net.minecraft.nbt.NbtCompound) on the client.

      "Observable state" is a state that clients can observe without specific interaction. For example, CampfireBlockEntity's cooked items are observable states, but chests' inventories are not observable states, since the player must first open that chest before they can see the contents.

      To sync block entity data using this method, use serverWorld.getChunkManager().markForUpdate(this.getPos());.

      Overrides:
      toUpdatePacket in class BlockEntity
      Returns:
      the packet to send to nearby players when the block entity's observable state changes, or null to not send the packet
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official c Ldaw;c()Luz;
      intermediary method_38251 Lnet/minecraft/class_2636;method_38251()Lnet/minecraft/class_2622;
      named toUpdatePacket Lnet/minecraft/block/entity/MobSpawnerBlockEntity;toUpdatePacket()Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;
    • toInitialChunkDataNbt

      public NbtCompound toInitialChunkDataNbt()
      Returns the serialized state of this block entity that is observable by clients.

      This is sent alongside the initial chunk data, as well as when the block entity implements BlockEntity.toUpdatePacket() and decides to use the default BlockEntityUpdateS2CPacket.

      "Observable state" is a state that clients can observe without specific interaction. For example, CampfireBlockEntity's cooked items are observable states, but chests' inventories are not observable states, since the player must first open that chest before they can see the contents.

      To send all NBT data of this block entity saved to disk, return BlockEntity.createNbt().

      Overrides:
      toInitialChunkDataNbt in class BlockEntity
      Returns:
      the serialized state of this block entity that is observable by clients
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official ao_ Lczk;ao_()Lqr;
      intermediary method_16887 Lnet/minecraft/class_2586;method_16887()Lnet/minecraft/class_2487;
      named toInitialChunkDataNbt Lnet/minecraft/block/entity/BlockEntity;toInitialChunkDataNbt()Lnet/minecraft/nbt/NbtCompound;
    • onSyncedBlockEvent

      public boolean onSyncedBlockEvent(int type, int data)
      Overrides:
      onSyncedBlockEvent in class BlockEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a_ Lczk;a_(II)Z
      intermediary method_11004 Lnet/minecraft/class_2586;method_11004(II)Z
      named onSyncedBlockEvent Lnet/minecraft/block/entity/BlockEntity;onSyncedBlockEvent(II)Z
    • copyItemDataRequiresOperator

      public boolean copyItemDataRequiresOperator()
      Returns whether the block item should require the player to have operator permissions to copy the block entity data on placement.

      Block entities that can execute commands should override this to return true.

      Overrides:
      copyItemDataRequiresOperator in class BlockEntity
      Returns:
      whether the block item should require the player to have operator permissions to copy the block entity data on placement
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official t Lczk;t()Z
      intermediary method_11011 Lnet/minecraft/class_2586;method_11011()Z
      named copyItemDataRequiresOperator Lnet/minecraft/block/entity/BlockEntity;copyItemDataRequiresOperator()Z
    • setEntityType

      public void setEntityType(EntityType<?> entityType, Random random)
      Mappings:
      Namespace Name Mixin selector
      official a Ldaw;a(Lbfl;Lapf;)V
      intermediary method_46408 Lnet/minecraft/class_2636;method_46408(Lnet/minecraft/class_1299;Lnet/minecraft/class_5819;)V
      named setEntityType Lnet/minecraft/block/entity/MobSpawnerBlockEntity;setEntityType(Lnet/minecraft/entity/EntityType;Lnet/minecraft/util/math/random/Random;)V
    • getLogic

      public MobSpawnerLogic getLogic()
      Mappings:
      Namespace Name Mixin selector
      official d Ldaw;d()Lclm;
      intermediary method_11390 Lnet/minecraft/class_2636;method_11390()Lnet/minecraft/class_1917;
      named getLogic Lnet/minecraft/block/entity/MobSpawnerBlockEntity;getLogic()Lnet/minecraft/world/MobSpawnerLogic;