Search in sources :

Example 6 with SoundEvent

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

the class SoundEventListSetting method save.

@Override
public NbtCompound save(NbtCompound tag) {
    NbtList valueTag = new NbtList();
    for (SoundEvent sound : get()) {
        Identifier id = Registry.SOUND_EVENT.getId(sound);
        if (id != null)
            valueTag.add(NbtString.of(id.toString()));
    }
    tag.put("value", valueTag);
    return tag;
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList)

Example 7 with SoundEvent

use of net.minecraft.sound.SoundEvent in project KiwiClient by TangyKiwi.

the class KiwiClient method onInitialize.

@Override
public void onInitialize() {
    mc = MinecraftClient.getInstance();
    Utils.mc = mc;
    CustomMatrix.begin(new MatrixStack());
    moduleManager = new ModuleManager();
    moduleManager.init();
    commandManager = new CommandManager();
    commandManager.init();
    discordRPC = new DiscordRP();
    discordRPC.start();
    EChestMemory eChestMemory = new EChestMemory();
    TickRate tickRate = new TickRate();
    eventBus.register(eChestMemory);
    eventBus.register(tickRate);
    eventBus.register(moduleManager);
    ClickGui.clickGui.initWindows();
    FabricLoader.getInstance().getModContainer("kiwiclient").ifPresent(modContainer -> {
        ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("kiwiclient:kiwitweaks"), "resourcepacks/kiwitweaks", modContainer, true);
    });
    UseItemCallback.EVENT.register((player, world, hand) -> {
        MinecraftClient mc = MinecraftClient.getInstance();
        ClientPlayerInteractionManager interactionManager = mc.interactionManager;
        if (mc.mouse.wasRightButtonClicked() && moduleManager.getModule(ArmorSwap.class).isEnabled()) {
            ItemStack stack = player.getMainHandStack();
            int currentItemIndex = player.getInventory().main.indexOf(stack);
            EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(stack);
            int armorIndexSlot = determineIndex(equipmentSlot);
            if (hand == Hand.MAIN_HAND && armorIndexSlot != -1) {
                SoundEvent sound = determineSound(stack.getItem());
                player.playSound(sound, 1.0F, 1.0F);
                interactionManager.clickSlot(player.playerScreenHandler.syncId, armorIndexSlot, currentItemIndex, SlotActionType.SWAP, player);
                return TypedActionResult.success(stack);
            }
        }
        return TypedActionResult.pass(ItemStack.EMPTY);
    });
    KeyBindingHelper.registerKeyBinding(zoomKey);
}
Also used : ClientPlayerInteractionManager(net.minecraft.client.network.ClientPlayerInteractionManager) MatrixStack(net.minecraft.client.util.math.MatrixStack) EquipmentSlot(net.minecraft.entity.EquipmentSlot) ModuleManager(com.tangykiwi.kiwiclient.modules.ModuleManager) EChestMemory(com.tangykiwi.kiwiclient.util.tooltip.EChestMemory) SoundEvent(net.minecraft.sound.SoundEvent) CommandManager(com.tangykiwi.kiwiclient.command.CommandManager) Identifier(net.minecraft.util.Identifier) MinecraftClient(net.minecraft.client.MinecraftClient) ItemStack(net.minecraft.item.ItemStack)

Example 8 with SoundEvent

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

the class PingLogic method pingOnlinePlayer.

public static void pingOnlinePlayer(ServerPlayerEntity player, Text message, MessageType type, UUID senderUUID) {
    SoundEvent pingSound = PlayerUtils.getPingSound(player);
    if (pingSound != null) {
        player.playSound(pingSound, SoundCategory.PLAYERS, 1.0F, 1.0F);
    }
    List<Text> unreadPings = PlayerUtils.getUnreadPingsFor(player);
    while (unreadPings.size() >= 100) {
        unreadPings.remove(0);
    }
    unreadPings.add(message);
    Text pingMessage = message.shallowCopy().formatted(Formatting.AQUA);
    player.networkHandler.sendPacket(new GameMessageS2CPacket(pingMessage, type, senderUUID));
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent) GameMessageS2CPacket(net.minecraft.network.packet.s2c.play.GameMessageS2CPacket) LiteralText(net.minecraft.text.LiteralText) Text(net.minecraft.text.Text)

Example 9 with SoundEvent

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

the class GlareEntity method playRustleSound.

public void playRustleSound() {
    SoundEvent soundEvent = this.getRustleSound();
    this.playSound(soundEvent, 0.15F, 0.1F);
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent)

Example 10 with SoundEvent

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

the class GlareEntity method playGrumpinessShortSound.

public void playGrumpinessShortSound() {
    SoundEvent soundEvent = this.getGrumpinessShortSound();
    this.playSound(soundEvent, 0.05F, RandomGenerator.generateFloat(1.2F, 1.3F));
}
Also used : SoundEvent(net.minecraft.sound.SoundEvent)

Aggregations

SoundEvent (net.minecraft.sound.SoundEvent)35 Identifier (net.minecraft.util.Identifier)13 NbtList (net.minecraft.nbt.NbtList)4 ArrayList (java.util.ArrayList)2 Random (java.util.Random)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 BlockPos (net.minecraft.util.math.BlockPos)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 ModuleManager (com.tangykiwi.kiwiclient.modules.ModuleManager)1 EChestMemory (com.tangykiwi.kiwiclient.util.tooltip.EChestMemory)1 HashMap (java.util.HashMap)1