use of com.tangykiwi.kiwiclient.command.CommandManager 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);
}
Aggregations