Search in sources :

Example 16 with SoundEvent

use of net.minecraft.sound.SoundEvent in project alaskanativecraft by Platymemo.

the class SealEntity method playStepSound.

@Override
protected void playStepSound(BlockPos pos, BlockState state) {
    SoundEvent soundEvent = this.isBaby() ? SoundEvents.ENTITY_TURTLE_SHAMBLE_BABY : SoundEvents.ENTITY_TURTLE_SHAMBLE;
    this.playSound(soundEvent, 0.15F, 1.0F);
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent)

Example 17 with SoundEvent

use of net.minecraft.sound.SoundEvent in project Illager-Expansion by OhDricky.

the class HatchetEntity method onEntityHit.

@Override
protected void onEntityHit(EntityHitResult entityHitResult) {
    Entity entity2;
    Entity entity = entityHitResult.getEntity();
    float f = 8.0f;
    if (entity instanceof LivingEntity) {
        LivingEntity livingEntity = (LivingEntity) entity;
        f += EnchantmentHelper.getAttackDamage(this.hatchetStack, livingEntity.getGroup());
    }
    DamageSource damageSource = DamageSource.trident(this, (entity2 = this.getOwner()) == null ? this : entity2);
    this.dealtDamage = true;
    SoundEvent soundEvent = SoundEvents.ITEM_TRIDENT_HIT;
    if (entity.damage(damageSource, f)) {
        if (entity.getType() == EntityType.ENDERMAN) {
            return;
        }
        if (entity instanceof LivingEntity) {
            LivingEntity livingEntity2 = (LivingEntity) entity;
            if (entity2 instanceof LivingEntity) {
                EnchantmentHelper.onUserDamaged(livingEntity2, entity2);
                EnchantmentHelper.onTargetDamaged((LivingEntity) entity2, livingEntity2);
            }
            this.onHit(livingEntity2);
        }
    }
    this.setVelocity(this.getVelocity().multiply(-0.01, -0.1, -0.01));
    float g = 1.0f;
    this.playSound(soundEvent, g, 1.0f);
}
Also used : PersistentProjectileEntity(net.minecraft.entity.projectile.PersistentProjectileEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) SoundEvent(net.minecraft.sound.SoundEvent) DamageSource(net.minecraft.entity.damage.DamageSource)

Example 18 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)

Example 19 with SoundEvent

use of net.minecraft.sound.SoundEvent in project mineclub-expanded by Blobanium.

the class SoundPlayer method playSound.

public static void playSound(float pitch) {
    SoundEvent sound = registerSound();
    PositionedSoundInstance posSound = PositionedSoundInstance.master(sound, pitch, getVolume(ConfigReader.outbidVolume));
    MinecraftClient.getInstance().getSoundManager().play(posSound);
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) PositionedSoundInstance(net.minecraft.client.sound.PositionedSoundInstance)

Example 20 with SoundEvent

use of net.minecraft.sound.SoundEvent in project pingspam by BasiqueEvangelist.

the class PingSoundCommand method setPingSound.

private static int setPingSound(CommandContext<ServerCommandSource> ctx) throws CommandSyntaxException {
    ServerCommandSource src = ctx.getSource();
    ServerPlayerEntity player = src.getPlayer();
    Identifier soundId = IdentifierArgumentType.getIdentifier(ctx, "sound");
    SoundEvent event = Registry.SOUND_EVENT.getOrEmpty(soundId).orElseThrow(INVALID_SOUND::create);
    PlayerUtils.setPingSound(player, event);
    src.sendFeedback(new LiteralText("Set ping sound to ").formatted(Formatting.GREEN).append(new LiteralText(((SoundEventAccessor) PlayerUtils.getPingSound(player)).pingspam$getId().toString()).formatted(Formatting.YELLOW)).append(new LiteralText(".")), false);
    return 0;
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) Identifier(net.minecraft.util.Identifier) SoundEventAccessor(me.basiqueevangelist.pingspam.mixin.SoundEventAccessor) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) ServerCommandSource(net.minecraft.server.command.ServerCommandSource) LiteralText(net.minecraft.text.LiteralText)

Aggregations

SoundEvent (net.minecraft.sound.SoundEvent)38 Identifier (net.minecraft.util.Identifier)14 PlayerEntity (net.minecraft.entity.player.PlayerEntity)4 NbtList (net.minecraft.nbt.NbtList)4 World (net.minecraft.world.World)3 ArrayList (java.util.ArrayList)2 Random (java.util.Random)2 ItemStack (net.minecraft.item.ItemStack)2 NbtElement (net.minecraft.nbt.NbtElement)2 NbtString (net.minecraft.nbt.NbtString)2 SoundCategory (net.minecraft.sound.SoundCategory)2 SoundEvents (net.minecraft.sound.SoundEvents)2 BlockPos (net.minecraft.util.math.BlockPos)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2 AshBlock (com.ordana.immersive_weathering.registry.blocks.AshBlock)1 ModBlocks (com.ordana.immersive_weathering.registry.blocks.ModBlocks)1 SootBlock (com.ordana.immersive_weathering.registry.blocks.SootBlock)1 Weatherable (com.ordana.immersive_weathering.registry.blocks.Weatherable)1 ModItems (com.ordana.immersive_weathering.registry.items.ModItems)1 CommandManager (com.tangykiwi.kiwiclient.command.CommandManager)1