Class MobSpawnerBlockEntity
- All Implemented Interfaces:
Spawner
- Mappings:
Namespace Name named net/minecraft/block/entity/MobSpawnerBlockEntity
intermediary net/minecraft/class_2636
official ecr
-
Field Summary
FieldsFields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, world
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clientTick
(World world, BlockPos pos, BlockState state, MobSpawnerBlockEntity blockEntity) getLogic()
boolean
onSyncedBlockEvent
(int type, int data) If this block entity's block extendsBlockWithEntity
, this is called insideAbstractBlock.onSyncedBlockEvent(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, int, int)
.protected void
Reads data fromnbt
.static void
serverTick
(World world, BlockPos pos, BlockState state, MobSpawnerBlockEntity blockEntity) void
setEntityType
(EntityType<?> type, Random random) toInitialChunkDataNbt
(RegistryWrapper.WrapperLookup registries) Returns the serialized state of this block entity that is observable by clients.Returns the packet to send to nearby players when the block entity's observable state changes, ornull
to not send the packet.protected void
Writes data tonbt
.Methods inherited from class net.minecraft.block.entity.BlockEntity
addComponents, cancelRemoval, createComponentlessNbt, createComponentMap, createFromNbt, createNbt, createNbtWithIdentifyingData, getCachedState, getComponents, getNameForReport, getPos, getReporterContext, getType, getWorld, hasWorld, isRemoved, markDirty, markDirty, markRemoved, onBlockReplaced, populateCrashReport, posFromNbt, read, readComponentlessData, readComponents, readComponents, readComponents, removeFromCopiedStackData, setCachedState, setComponents, setWorld, supports, tryParseCustomName, writeComponentlessData, writeDataWithId, writeDataWithoutId, writeFullData, writeId
-
Field Details
-
logic
- Mappings:
Namespace Name Mixin selector named logic
Lnet/minecraft/block/entity/MobSpawnerBlockEntity;logic:Lnet/minecraft/block/spawner/MobSpawnerLogic;
intermediary field_12114
Lnet/minecraft/class_2636;field_12114:Lnet/minecraft/class_1917;
official a
Lecr;a:Ldlu;
-
-
Constructor Details
-
MobSpawnerBlockEntity
- Mappings:
Namespace Name Mixin selector named <init>
Lnet/minecraft/block/entity/MobSpawnerBlockEntity;<init>(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V
intermediary <init>
Lnet/minecraft/class_2636;<init>(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)V
official <init>
Lecr;<init>(Ljb;Leeb;)V
-
-
Method Details
-
readData
Reads data fromnbt
. 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:
readData
in classBlockEntity
- See Also:
- Mappings:
Namespace Name Mixin selector named readData
Lnet/minecraft/block/entity/BlockEntity;readData(Lnet/minecraft/storage/ReadView;)V
intermediary method_11014
Lnet/minecraft/class_2586;method_11014(Lnet/minecraft/class_11368;)V
official a
Leaz;a(Lfda;)V
-
writeData
Writes data tonbt
. 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:
writeData
in classBlockEntity
- See Also:
- Mappings:
Namespace Name Mixin selector named writeData
Lnet/minecraft/block/entity/BlockEntity;writeData(Lnet/minecraft/storage/WriteView;)V
intermediary method_11007
Lnet/minecraft/class_2586;method_11007(Lnet/minecraft/class_11372;)V
official a
Leaz;a(Lfdc;)V
-
clientTick
public static void clientTick(World world, BlockPos pos, BlockState state, MobSpawnerBlockEntity blockEntity) - Mappings:
Namespace Name Mixin selector 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
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
official a
Lecr;a(Ldmu;Ljb;Leeb;Lecr;)V
-
serverTick
public static void serverTick(World world, BlockPos pos, BlockState state, MobSpawnerBlockEntity blockEntity) - Mappings:
Namespace Name Mixin selector 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
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
official b
Lecr;b(Ldmu;Ljb;Leeb;Lecr;)V
-
toUpdatePacket
Description copied from class:BlockEntity
Returns the packet to send to nearby players when the block entity's observable state changes, ornull
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 toinvalid reference
#readNbt
"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 classBlockEntity
- 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 named toUpdatePacket
Lnet/minecraft/block/entity/MobSpawnerBlockEntity;toUpdatePacket()Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;
intermediary method_38251
Lnet/minecraft/class_2636;method_38251()Lnet/minecraft/class_2622;
official a
Lecr;a()Lacw;
-
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
toUpdatePacket()
and decides to use the defaultBlockEntityUpdateS2CPacket
."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(net.minecraft.registry.RegistryWrapper.WrapperLookup)
.- Overrides:
toInitialChunkDataNbt
in classBlockEntity
- Returns:
- the serialized state of this block entity that is observable by clients
- See Also:
- Mappings:
Namespace Name Mixin selector named toInitialChunkDataNbt
Lnet/minecraft/block/entity/BlockEntity;toInitialChunkDataNbt(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/nbt/NbtCompound;
intermediary method_16887
Lnet/minecraft/class_2586;method_16887(Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_2487;
official a
Leaz;a(Ljn$a;)Lui;
-
onSyncedBlockEvent
public boolean onSyncedBlockEvent(int type, int data) If this block entity's block extendsBlockWithEntity
, this is called insideAbstractBlock.onSyncedBlockEvent(net.minecraft.block.BlockState, net.minecraft.world.World, net.minecraft.util.math.BlockPos, int, int)
.- Overrides:
onSyncedBlockEvent
in classBlockEntity
- See Also:
- Mappings:
Namespace Name Mixin selector named onSyncedBlockEvent
Lnet/minecraft/block/entity/BlockEntity;onSyncedBlockEvent(II)Z
intermediary method_11004
Lnet/minecraft/class_2586;method_11004(II)Z
official a_
Leaz;a_(II)Z
-
setEntityType
- Specified by:
setEntityType
in interfaceSpawner
- Mappings:
Namespace Name Mixin selector named setEntityType
Lnet/minecraft/block/entity/Spawner;setEntityType(Lnet/minecraft/entity/EntityType;Lnet/minecraft/util/math/random/Random;)V
intermediary method_46408
Lnet/minecraft/class_8959;method_46408(Lnet/minecraft/class_1299;Lnet/minecraft/class_5819;)V
official a
Ldnp;a(Lbzv;Lbck;)V
-
getLogic
- Mappings:
Namespace Name Mixin selector named getLogic
Lnet/minecraft/block/entity/MobSpawnerBlockEntity;getLogic()Lnet/minecraft/block/spawner/MobSpawnerLogic;
intermediary method_11390
Lnet/minecraft/class_2636;method_11390()Lnet/minecraft/class_1917;
official c
Lecr;c()Ldlu;
-