Download For the Love of God Would You Shut Up — Minecraft Mods — MetaMods

For the Love of God Would You Shut Up

Archived

Downloads

0

Last update

3 years ago

Versions

22w13a — 22w14a
Client
Fabric
Utils

For the Love of God Would You Shut Up

This mod reverses the alteration introduced in snapshot 22w13a, where note blocks produced sounds even with blocks placed above them. The primary objective of this modification is to reduce the annoyance factor in redstone mechanisms by silencing note blocks when anything is positioned on top of them.

Important to note: despite the sound suppression, note blocks continue to emit game events, enabling the activation of allays and sculk sensors.

Explanation of Code Modifications

The original code for note playback appeared as follows:

private void playNote(World world, BlockPos pos) {
    if (world.getBlockState(pos.up()).isAir()) {
        world.addSyncedBlockEvent(pos, this, 0, 0); // plays sound
    }
}

In version 22w13a, a game event system for note blocks was implemented, with sound blocking occurring only when wool or carpet was above:

private void playNote(@Nullable Entity entity, World world, BlockPos pos) {
    BlockState blockState = world.getBlockState(pos.up());
    if (blockState.isIn(BlockTags.WOOL) || blockState.isIn(BlockTags.WOOL_CARPETS)) {
        return;
    }
    world.addSyncedBlockEvent(pos, this, 0, 0); // plays sound
    world.emitGameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, pos); // notifies allays, warden, and sculk sensors
}

This mod implements the following adjustments to the codeessentially converts world.addSyncedBlockEvent into a method containing the conditional check

private void playNote(@Nullable Entity entity, World world, BlockPos pos) {
    BlockState blockState = world.getBlockState(pos.up());
    if (blockState.isIn(BlockTags.WOOL) || blockState.isIn(BlockTags.WOOL_CARPETS)) {
        return;
    }
+   if (world.getBlockState(pos.up()).isAir()) {
+       world.addSyncedBlockEvent(pos, this, 0, 0); // plays sound
+   }
-   world.addSyncedBlockEvent(pos, this, 0, 0);
    world.emitGameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, pos); // notifies allays, warden, and sculk sensors
}

Given that the mod's sole purpose is to mitigate redstone irritation, it simply mutes note block sounds when any blocks are overhead, while preserving notification functionality for allies and sculks.

The project is distributed under the Unlicense.

Project members
F53

F53

Developer

CassieNya

CassieNya

Developer

Created: 11 Apr 2022

ID: 21247