Stop the jukebox's song and the beacon as their block entities go
LevelChunk.removeBlockEntity calls setRemoved: a jukebox reports its song stopping (the jukebox_stop_play game event and level event 1011) and a beacon plays its deactivation, whatever the flags. A record popped from a replaced jukebox stops a playing song first and updates the neighbours as JukeboxBlockEntity.onSongChanged does (a redstone wire beside it can pop). The block update oracle removes block entities the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -81,13 +81,14 @@ public final class VanillaBlockUpdateOracle {
|
||||
boolean movedByPiston = (flags & 64) != 0;
|
||||
boolean sideEffects = (flags & 256) == 0;
|
||||
if (blockChanged && old.hasBlockEntity() && !state.shouldChangedStateKeepBlockEntity(old)) {
|
||||
if (sideEffects) {
|
||||
BlockEntity blockEntity = world.blockEntityFor(pos.immutable(), old);
|
||||
if (blockEntity != null) {
|
||||
blockEntity.preRemoveSideEffects(pos, old);
|
||||
}
|
||||
// A real chunk always holds the block entity of an entity block.
|
||||
BlockEntity blockEntity = world.blockEntityFor(pos.immutable(), old);
|
||||
if (sideEffects && blockEntity != null) {
|
||||
blockEntity.preRemoveSideEffects(pos, old);
|
||||
}
|
||||
// LevelChunk.removeBlockEntity.
|
||||
if (world.blockEntities != null) world.blockEntities.remove(pos);
|
||||
if (blockEntity != null) blockEntity.setRemoved();
|
||||
}
|
||||
if ((blockChanged || newBlock instanceof net.minecraft.world.level.block.BaseRailBlock) && ((flags & 1) != 0 || movedByPiston)) {
|
||||
old.affectNeighborsAfterRemoval(world, pos, movedByPiston);
|
||||
|
||||
Reference in New Issue
Block a user