Search in sources :

Example 1 with WeightedSoundSet

use of net.minecraft.client.sound.WeightedSoundSet in project meteor-client by MeteorDevelopment.

the class Names method getSoundName.

public static String getSoundName(Identifier id) {
    return soundNames.computeIfAbsent(id, identifier -> {
        WeightedSoundSet soundSet = mc.getSoundManager().get(identifier);
        if (soundSet == null)
            return identifier.getPath();
        Text text = soundSet.getSubtitle();
        if (text == null)
            return identifier.getPath();
        return StringHelper.stripTextFormat(text.getString());
    });
}
Also used : WeightedSoundSet(net.minecraft.client.sound.WeightedSoundSet) TranslatableText(net.minecraft.text.TranslatableText) Text(net.minecraft.text.Text)

Example 2 with WeightedSoundSet

use of net.minecraft.client.sound.WeightedSoundSet in project LittleMaidModelLoader-Fabric by SistrScarlet.

the class SoundHolder method addSound.

public void addSound(String fileName, Identifier resource) {
    WeightedSoundSet soundSet = sounds.computeIfAbsent(fileName.toLowerCase(), k -> new WeightedSoundSet(resource, resource.toString().replace("/", ".")));
    soundSet.add(new Sound(resource.toString(), 1F, 1F, 1, Sound.RegistrationType.FILE, false, false, 16) {

        @Override
        public Identifier getLocation() {
            return getIdentifier();
        }
    });
}
Also used : Identifier(net.minecraft.util.Identifier) WeightedSoundSet(net.minecraft.client.sound.WeightedSoundSet) Sound(net.minecraft.client.sound.Sound)

Example 3 with WeightedSoundSet

use of net.minecraft.client.sound.WeightedSoundSet in project Client by MatHax.

the class SoundLocator method printSound.

private void printSound(SoundInstance sound) {
    WeightedSoundSet soundSet = mc.getSoundManager().get(sound.getId());
    MutableText text = soundSet.getSubtitle().copy();
    text.append(String.format("%s at ", Formatting.GRAY));
    Vec3d pos = new Vec3d(sound.getX(), sound.getY(), sound.getZ());
    text.append(ChatUtils.formatCoords(pos));
    text.append(String.format("%s.", Formatting.GRAY));
    info(text);
}
Also used : MutableText(net.minecraft.text.MutableText) WeightedSoundSet(net.minecraft.client.sound.WeightedSoundSet) Vec3d(net.minecraft.util.math.Vec3d)

Example 4 with WeightedSoundSet

use of net.minecraft.client.sound.WeightedSoundSet in project meteor-rejects by AntiCope.

the class SoundLocator method printSound.

private void printSound(SoundInstance sound) {
    WeightedSoundSet soundSet = mc.getSoundManager().get(sound.getId());
    MutableText text = soundSet.getSubtitle().copy();
    text.append(String.format("%s at ", Formatting.RESET));
    Vec3d pos = new Vec3d(sound.getX(), sound.getY(), sound.getZ());
    text.append(ChatUtils.formatCoords(pos));
    text.append(String.format("%s.", Formatting.RESET));
    info(text);
}
Also used : MutableText(net.minecraft.text.MutableText) WeightedSoundSet(net.minecraft.client.sound.WeightedSoundSet) Vec3d(net.minecraft.util.math.Vec3d)

Example 5 with WeightedSoundSet

use of net.minecraft.client.sound.WeightedSoundSet in project Client by MatHax.

the class Names method getSoundName.

public static String getSoundName(Identifier id) {
    return soundNames.computeIfAbsent(id, identifier -> {
        WeightedSoundSet soundSet = mc.getSoundManager().get(identifier);
        if (soundSet == null)
            return identifier.getPath();
        Text text = soundSet.getSubtitle();
        if (text == null)
            return identifier.getPath();
        return StringHelper.stripTextFormat(text.getString());
    });
}
Also used : WeightedSoundSet(net.minecraft.client.sound.WeightedSoundSet) TranslatableText(net.minecraft.text.TranslatableText) Text(net.minecraft.text.Text)

Aggregations

WeightedSoundSet (net.minecraft.client.sound.WeightedSoundSet)5 MutableText (net.minecraft.text.MutableText)2 Text (net.minecraft.text.Text)2 TranslatableText (net.minecraft.text.TranslatableText)2 Vec3d (net.minecraft.util.math.Vec3d)2 Sound (net.minecraft.client.sound.Sound)1 Identifier (net.minecraft.util.Identifier)1