I'm trying to make a block that, when it gets a redstone signal, it makes the creeper sound to the nearest player. This works, but when the redstone wire that is powering it is getting its power from through a block, the block plays the sound upon receiving the redstone signal, but plays it again and much louder upon losing the signal. Here is the block code that makes the sound:
@SideOnly(Side.CLIENT)
@Override
public void onNeighborBlockChange(World world, int x,int y, int z, Block block) {
if (!world.isRemote && world.isBlockIndirectlyGettingPowered(x, y, z)) {
world.playSoundAtEntity(world.getClosestPlayer(x, y, z, 20), "creeper.primed", 1.0F, 0.5F);
return;
} else {
return;
}
}