summaryrefslogtreecommitdiff
path: root/src/main/java/com/arslaancodes/arslaansmagichax/modules/impl/Spider.java
blob: d691f45158e10b4f568f4d08acfe4eff67e8fe95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.arslaancodes.arslaansmagichax.modules.impl;

import com.arslaancodes.arslaansmagichax.modules.Category;
import com.arslaancodes.arslaansmagichax.modules.Module;
import com.arslaancodes.arslaansmagichax.modules.settings.NumberSetting;
import net.minecraft.network.chat.Component;
import net.minecraft.world.phys.Vec3;

public class Spider extends Module {
    private NumberSetting climbSpeed = new NumberSetting("Climb Speed", 0, 1, 0.2, 0.1);

    @Override
    protected void onEnable() {
        if (mc.player == null) return;
        mc.player.sendSystemMessage(Component.literal("[Spider] It is recommended to use this hack in combination with NoFall."));
    }

    public Spider() {
        super("Spider", "Allows you to climb walls like a spider.", -1, Category.MOVEMENT);
        addSetting(climbSpeed);
    }

    @Override
    public void tick() {
        if (!this.isEnabled() || mc.player == null) return;
        if (!mc.player.horizontalCollision) return;

        Vec3 velocity = mc.player.getDeltaMovement();
        if (velocity.y >= 0.2) return;

        mc.player.setDeltaMovement(velocity.x, climbSpeed.getValue(), velocity.z);
    }
}