Search in sources :

Example 1 with JukeboxBlockAccessor

use of org.spongepowered.common.accessor.world.level.block.JukeboxBlockAccessor in project SpongeCommon by SpongePowered.

the class JukeboxBlockEntityMixin_API method eject.

@SuppressWarnings("deprecation")
@Override
public void eject() {
    final BlockState block = this.level.getBlockState(this.shadow$getBlockPos());
    if (block.getBlock() == Blocks.JUKEBOX) {
        ((JukeboxBlockAccessor) block.getBlock()).invoker$dropRecording(this.level, this.shadow$getBlockPos());
        this.level.setBlock(this.shadow$getBlockPos(), block.setValue(JukeboxBlock.HAS_RECORD, false), Constants.BlockChangeFlags.NOTIFY_CLIENTS);
    }
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) JukeboxBlockAccessor(org.spongepowered.common.accessor.world.level.block.JukeboxBlockAccessor)

Aggregations

BlockState (net.minecraft.world.level.block.state.BlockState)1 JukeboxBlockAccessor (org.spongepowered.common.accessor.world.level.block.JukeboxBlockAccessor)1