use of net.minecraft.sound.SoundEvent in project Architects-Palette-Fabric by Slomaxonical-907.
the class CageLanternBlock method onUse.
@Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockHitResult hit) {
BlockState newState = state.with(INVERTED, !state.get(INVERTED));
worldIn.setBlockState(pos, newState.with(LIT, getLitState(newState, worldIn, pos)), 2);
SoundEvent click = state.get(INVERTED) ? APSounds.CAGE_LANTERN_TOGGLE_OFF : APSounds.CAGE_LANTERN_TOGGLE_ON;
worldIn.playSound(player, pos, click, SoundCategory.BLOCKS, 1, 1);
return ActionResult.success(worldIn.isClient);
}
Aggregations