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);
}
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);
}
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;
}
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);
}
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;
}
Aggregations