Search in sources :

Example 11 with SoundEvent

use of net.minecraft.sound.SoundEvent in project friends-and-foes by Faboslav.

the class GlareEntity method playEatSound.

public void playEatSound(ItemStack stack) {
    SoundEvent soundEvent = this.getEatSound(stack);
    this.playSound(soundEvent, 1.0F, 1.0F);
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent)

Example 12 with SoundEvent

use of net.minecraft.sound.SoundEvent in project friends-and-foes by Faboslav.

the class IceologerIceChunkEntity method playSummonSound.

private void playSummonSound() {
    SoundEvent soundEvent = this.getSummonSound();
    this.playSound(soundEvent, 1.0F, RandomGenerator.generateFloat(0.95F, 1.05F));
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent)

Example 13 with SoundEvent

use of net.minecraft.sound.SoundEvent in project Hypnotic-Client by Hypnotic-Development.

the class Explosion method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.executes(context -> {
        int min = -5;
        int max = 5;
        mc.player.addVelocity(new Random().nextInt(max - min) + min, new Random().nextInt(3 - 1) + 1, new Random().nextInt(max - min) + min);
        info("BOOM... exploded");
        mc.world.addParticle(ParticleTypes.EXPLOSION_EMITTER, mc.player.getX(), mc.player.getY() + 0.5D, mc.player.getZ(), 0.0D, 0.0D, 0.0D);
        mc.getSoundManager().play(PositionedSoundInstance.ambient(new SoundEvent(new Identifier("entity.generic.explode")), 1, 1));
        return SINGLE_SUCCESS;
    });
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) Identifier(net.minecraft.util.Identifier) Random(java.util.Random)

Example 14 with SoundEvent

use of net.minecraft.sound.SoundEvent in project CopperEquipment by Redy1aye.

the class CopperBucket method playEmptyingSound.

protected void playEmptyingSound(@Nullable PlayerEntity player, WorldAccess world, BlockPos pos) {
    SoundEvent soundEvent = this.fluid.isIn(FluidTags.LAVA) ? SoundEvents.ITEM_BUCKET_EMPTY_LAVA : SoundEvents.ITEM_BUCKET_EMPTY;
    world.playSound(player, pos, soundEvent, SoundCategory.BLOCKS, 1.0F, 1.0F);
    world.emitGameEvent(player, GameEvent.FLUID_PLACE, pos);
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent)

Example 15 with SoundEvent

use of net.minecraft.sound.SoundEvent in project Liminal-Library by LudoCrypt.

the class ServerPlayerEntityMixin method limlib$moveToWorld.

@Inject(method = "moveToWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 5, shift = Shift.AFTER))
public void limlib$moveToWorld(ServerWorld to, CallbackInfoReturnable<Entity> ci) {
    Optional<SoundEvent> sound = LiminalSoundRegistry.getCurrent(moveToWorld$from, to);
    if (sound != null) {
        this.networkHandler.sendPacket(new PlaySoundS2CPacket(sound.get(), SoundCategory.AMBIENT, this.getX(), this.getY(), this.getZ(), 0.25F, world.getRandom().nextFloat() * 0.4F + 0.8F));
    }
    this.moveToWorld$from = null;
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) PlaySoundS2CPacket(net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket) Inject(org.spongepowered.asm.mixin.injection.Inject)

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