Search in sources :

Example 1 with EChestMemory

use of com.tangykiwi.kiwiclient.util.tooltip.EChestMemory 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)

Aggregations

CommandManager (com.tangykiwi.kiwiclient.command.CommandManager)1 ModuleManager (com.tangykiwi.kiwiclient.modules.ModuleManager)1 EChestMemory (com.tangykiwi.kiwiclient.util.tooltip.EChestMemory)1 MinecraftClient (net.minecraft.client.MinecraftClient)1 ClientPlayerInteractionManager (net.minecraft.client.network.ClientPlayerInteractionManager)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1 EquipmentSlot (net.minecraft.entity.EquipmentSlot)1 ItemStack (net.minecraft.item.ItemStack)1 SoundEvent (net.minecraft.sound.SoundEvent)1 Identifier (net.minecraft.util.Identifier)1