Search in sources :

Example 1 with Setting

use of meteordevelopment.meteorclient.settings.Setting in project meteor-client by MeteorDevelopment.

the class ResetCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.then(literal("settings").then(argument("module", ModuleArgumentType.module()).executes(context -> {
        Module module = context.getArgument("module", Module.class);
        module.settings.forEach(group -> group.forEach(Setting::reset));
        module.info("Reset all settings.");
        return SINGLE_SUCCESS;
    })).then(literal("all").executes(context -> {
        Modules.get().getAll().forEach(module -> module.settings.forEach(group -> group.forEach(Setting::reset)));
        ChatUtils.info("Modules", "Reset all module settings");
        return SINGLE_SUCCESS;
    }))).then(literal("gui").executes(context -> {
        GuiThemes.get().clearWindowConfigs();
        ChatUtils.info("Reset GUI positioning.");
        return SINGLE_SUCCESS;
    })).then(literal("bind").then(argument("module", ModuleArgumentType.module()).executes(context -> {
        Module module = context.getArgument("module", Module.class);
        module.keybind.set(true, -1);
        module.info("Reset bind.");
        return SINGLE_SUCCESS;
    })).then(literal("all").executes(context -> {
        Modules.get().getAll().forEach(module -> module.keybind.set(true, -1));
        ChatUtils.info("Modules", "Reset all binds.");
        return SINGLE_SUCCESS;
    }))).then(literal("hud").executes(context -> {
        Systems.get(HUD.class).reset.run();
        ChatUtils.info("HUD", "Reset all elements.");
        return SINGLE_SUCCESS;
    }));
}
Also used : Systems(meteordevelopment.meteorclient.systems.Systems) HUD(meteordevelopment.meteorclient.systems.hud.HUD) CommandSource(net.minecraft.command.CommandSource) SINGLE_SUCCESS(com.mojang.brigadier.Command.SINGLE_SUCCESS) Setting(meteordevelopment.meteorclient.settings.Setting) Command(meteordevelopment.meteorclient.systems.commands.Command) Module(meteordevelopment.meteorclient.systems.modules.Module) Modules(meteordevelopment.meteorclient.systems.modules.Modules) ChatUtils(meteordevelopment.meteorclient.utils.player.ChatUtils) GuiThemes(meteordevelopment.meteorclient.gui.GuiThemes) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) ModuleArgumentType(meteordevelopment.meteorclient.systems.commands.arguments.ModuleArgumentType) HUD(meteordevelopment.meteorclient.systems.hud.HUD) Module(meteordevelopment.meteorclient.systems.modules.Module)

Example 2 with Setting

use of meteordevelopment.meteorclient.settings.Setting in project meteor-client by MeteorDevelopment.

the class NoFall method onTick.

@EventHandler
private void onTick(TickEvent.Pre event) {
    if (mc.player.getAbilities().creativeMode)
        return;
    // Airplace mode
    if (mode.get() == Mode.AirPlace) {
        // Test if fall damage setting is valid
        if (!airPlaceMode.get().test(mc.player.fallDistance))
            return;
        // Center and place block
        if (anchor.get())
            PlayerUtils.centerPlayer();
        Rotations.rotate(mc.player.getYaw(), 90, Integer.MAX_VALUE, () -> {
            double preY = mc.player.getVelocity().y;
            ((IVec3d) mc.player.getVelocity()).setY(0);
            BlockUtils.place(mc.player.getBlockPos().down(), InvUtils.findInHotbar(itemStack -> itemStack.getItem() instanceof BlockItem), false, 0, true);
            ((IVec3d) mc.player.getVelocity()).setY(preY);
        });
    }
    // Bucket mode
    if (mode.get() == Mode.Bucket) {
        if (mc.player.fallDistance > 3 && !EntityUtils.isAboveWater(mc.player)) {
            // Place water
            FindItemResult waterBucket = InvUtils.findInHotbar(Items.WATER_BUCKET);
            if (!waterBucket.found())
                return;
            // Center player
            if (anchor.get())
                PlayerUtils.centerPlayer();
            // Check if there is a block within 5 blocks
            BlockHitResult result = mc.world.raycast(new RaycastContext(mc.player.getPos(), mc.player.getPos().subtract(0, 5, 0), RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.NONE, mc.player));
            // Place water
            if (result != null && result.getType() == HitResult.Type.BLOCK) {
                useBucket(waterBucket, true);
            }
        }
        // Remove water
        if (placedWater && mc.player.getBlockStateAtPos().getFluidState().getFluid() == Fluids.WATER) {
            useBucket(InvUtils.findInHotbar(Items.BUCKET), false);
        }
    }
}
Also used : BlockUtils(meteordevelopment.meteorclient.utils.world.BlockUtils) Setting(meteordevelopment.meteorclient.settings.Setting) TickEvent(meteordevelopment.meteorclient.events.world.TickEvent) Module(meteordevelopment.meteorclient.systems.modules.Module) PlayerUtils(meteordevelopment.meteorclient.utils.player.PlayerUtils) BoolSetting(meteordevelopment.meteorclient.settings.BoolSetting) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) InvUtils(meteordevelopment.meteorclient.utils.player.InvUtils) Modules(meteordevelopment.meteorclient.systems.modules.Modules) RaycastContext(net.minecraft.world.RaycastContext) Hand(net.minecraft.util.Hand) Rotations(meteordevelopment.meteorclient.utils.player.Rotations) Fluids(net.minecraft.fluid.Fluids) BaritoneAPI(baritone.api.BaritoneAPI) PlayerMoveC2SPacketAccessor(meteordevelopment.meteorclient.mixin.PlayerMoveC2SPacketAccessor) EntityUtils(meteordevelopment.meteorclient.utils.entity.EntityUtils) Predicate(java.util.function.Predicate) Categories(meteordevelopment.meteorclient.systems.modules.Categories) BlockHitResult(net.minecraft.util.hit.BlockHitResult) IPlayerMoveC2SPacket(meteordevelopment.meteorclient.mixininterface.IPlayerMoveC2SPacket) SettingGroup(meteordevelopment.meteorclient.settings.SettingGroup) Items(net.minecraft.item.Items) PacketEvent(meteordevelopment.meteorclient.events.packets.PacketEvent) HitResult(net.minecraft.util.hit.HitResult) BlockItem(net.minecraft.item.BlockItem) IVec3d(meteordevelopment.meteorclient.mixininterface.IVec3d) PlayerMoveC2SPacket(net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket) EnumSetting(meteordevelopment.meteorclient.settings.EnumSetting) EventHandler(meteordevelopment.orbit.EventHandler) IVec3d(meteordevelopment.meteorclient.mixininterface.IVec3d) RaycastContext(net.minecraft.world.RaycastContext) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) BlockHitResult(net.minecraft.util.hit.BlockHitResult) BlockItem(net.minecraft.item.BlockItem) EventHandler(meteordevelopment.orbit.EventHandler)

Aggregations

Setting (meteordevelopment.meteorclient.settings.Setting)2 Module (meteordevelopment.meteorclient.systems.modules.Module)2 Modules (meteordevelopment.meteorclient.systems.modules.Modules)2 BaritoneAPI (baritone.api.BaritoneAPI)1 SINGLE_SUCCESS (com.mojang.brigadier.Command.SINGLE_SUCCESS)1 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)1 Predicate (java.util.function.Predicate)1 PacketEvent (meteordevelopment.meteorclient.events.packets.PacketEvent)1 TickEvent (meteordevelopment.meteorclient.events.world.TickEvent)1 GuiThemes (meteordevelopment.meteorclient.gui.GuiThemes)1 PlayerMoveC2SPacketAccessor (meteordevelopment.meteorclient.mixin.PlayerMoveC2SPacketAccessor)1 IPlayerMoveC2SPacket (meteordevelopment.meteorclient.mixininterface.IPlayerMoveC2SPacket)1 IVec3d (meteordevelopment.meteorclient.mixininterface.IVec3d)1 BoolSetting (meteordevelopment.meteorclient.settings.BoolSetting)1 EnumSetting (meteordevelopment.meteorclient.settings.EnumSetting)1 SettingGroup (meteordevelopment.meteorclient.settings.SettingGroup)1 Systems (meteordevelopment.meteorclient.systems.Systems)1 Command (meteordevelopment.meteorclient.systems.commands.Command)1 ModuleArgumentType (meteordevelopment.meteorclient.systems.commands.arguments.ModuleArgumentType)1 HUD (meteordevelopment.meteorclient.systems.hud.HUD)1