Search in sources :

Example 31 with SoundEvent

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);
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent)

Aggregations

SoundEvent (net.minecraft.sound.SoundEvent)31 Identifier (net.minecraft.util.Identifier)11 NbtList (net.minecraft.nbt.NbtList)4 ArrayList (java.util.ArrayList)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 NbtElement (net.minecraft.nbt.NbtElement)2 NbtString (net.minecraft.nbt.NbtString)2 BoatPaddleStateC2SPacket (net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket)2 LiteralText (net.minecraft.text.LiteralText)2 CommandManager (com.tangykiwi.kiwiclient.command.CommandManager)1 ModuleManager (com.tangykiwi.kiwiclient.modules.ModuleManager)1 EChestMemory (com.tangykiwi.kiwiclient.util.tooltip.EChestMemory)1 Optional (java.util.Optional)1 Random (java.util.Random)1 SoundEventAccessor (me.basiqueevangelist.pingspam.mixin.SoundEventAccessor)1 Environment (net.fabricmc.api.Environment)1 LiminalTravelSound (net.ludocrypt.limlib.api.sound.LiminalTravelSound)1 MinecraftClient (net.minecraft.client.MinecraftClient)1 ClientPlayerInteractionManager (net.minecraft.client.network.ClientPlayerInteractionManager)1 PositionedSoundInstance (net.minecraft.client.sound.PositionedSoundInstance)1