Skip to content

Commit

Permalink
Cleanup and added gap-toggle for AutoWalkHIG
Browse files Browse the repository at this point in the history
  • Loading branch information
RedCarlos26 committed Jan 31, 2024
1 parent 206777d commit e8661bb
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 42 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'fabric-loom' version '1.5-SNAPSHOT'
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
Expand All @@ -21,7 +21,7 @@ loom {

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_version}:v2"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation "meteordevelopment:meteor-client:${project.meteor_version}-SNAPSHOT"
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties (https://fabricmc.net/develop/)
minecraft_version=1.20.4
yarn_version=1.20.4+build.1
loader_version=0.15.0
yarn_mappings=1.20.4+build.3
loader_version=0.15.6

# Mod Properties
mod_version=2.7.1
maven_group=higtools.package
archives_base_name=HIGTools

# Meteor (https://maven.meteordev.org/)
meteor_version=0.5.5
meteor_version=0.5.6
5 changes: 2 additions & 3 deletions src/main/java/me/redcarlos/higtools/HIGTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ public void onInitialize() {
Commands.add(new Center());
Commands.add(new Coordinates());

// HUD
// Hud
Hud hud = Systems.get(Hud.class);
hud.register(BindsHud.INFO);
hud.register(WelcomeHudHig.INFO);

// Modules
Modules modules = Modules.get();

modules.add(new AfkLogout());
modules.add(new AutoCenter());
modules.add(new AutoWalkHig());
Expand All @@ -59,7 +58,7 @@ public void onInitialize() {
modules.add(new HotbarManager());
modules.add(new RotationHig());
modules.add(new ScaffoldPlus());

// Borers
modules.add(new AxisBorer());
modules.add(new NegNegBorer());
modules.add(new NegPosBorer());
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/me/redcarlos/higtools/modules/main/AutoWalkHig.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public class AutoWalkHig extends Module {
.build()
);

private final Setting<Boolean> gapToggle = sgGeneral.add(new BoolSetting.Builder()
.name("gap-toggle")
.description("Automatically disables AutoWalk-HIG when you run out of enchanted golden apples.")
.defaultValue(true)
.build()
);

private boolean sentMessage;

public AutoWalkHig() {
Expand Down Expand Up @@ -80,6 +87,15 @@ private void onTick(TickEvent.Pre event) {
if (!pickaxe.found()) {
error("No pickaxe found, disabling.");
toggle();
return;
}
}

if (gapToggle.get()) {
FindItemResult gapple = InvUtils.find(itemStack -> itemStack.getItem() == Items.ENCHANTED_GOLDEN_APPLE);
if (!gapple.found()) {
error("No gap found, disabling.");
toggle();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private boolean shouldEat() {
}

private void startEating() {
if (mc.player == null || mc.world == null) return;
if (mc.player == null || mc.world == null || mc.interactionManager == null) return;

mc.options.useKey.setPressed(true);
if (mc.player.isUsingItem()) return;
Expand Down
42 changes: 10 additions & 32 deletions src/main/java/me/redcarlos/higtools/modules/main/HotbarManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
import static me.redcarlos.higtools.utils.HIGUtils.csToPs;

public class HotbarManager extends Module {
private final Identifier[] itemIds = IntStream.range(0, 9)
.mapToObj(i -> new Identifier(""))
.toArray(Identifier[]::new);
private final Identifier[] itemIds = IntStream.range(0, 9).mapToObj(i -> new Identifier("")).toArray(Identifier[]::new);

private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final SettingGroup slotsGroup = settings.createGroup("Slots", false);
Expand All @@ -34,83 +32,63 @@ public class HotbarManager extends Module {
.name("slot0")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[0] = new Identifier(cur);
})
.onChanged(cur -> itemIds[0] = new Identifier(cur))
.build()
);

private final Setting<String> slot1 = slotsGroup.add(new StringSetting.Builder()
.name("slot1")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[1] = new Identifier(cur);
})
.onChanged(cur -> itemIds[1] = new Identifier(cur))
.build()
);

private final Setting<String> slot2 = slotsGroup.add(new StringSetting.Builder()
.name("slot2")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[2] = new Identifier(cur);
})
.onChanged(cur -> itemIds[2] = new Identifier(cur))
.build()
);
private final Setting<String> slot3 = slotsGroup.add(new StringSetting.Builder()
.name("slot3")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[3] = new Identifier(cur);
})
.onChanged(cur -> itemIds[3] = new Identifier(cur))
.build()
);
private final Setting<String> slot4 = slotsGroup.add(new StringSetting.Builder()
.name("slot4")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[4] = new Identifier(cur);
})
.onChanged(cur -> itemIds[4] = new Identifier(cur))
.build()
);
private final Setting<String> slot5 = slotsGroup.add(new StringSetting.Builder()
.name("slot5")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[5] = new Identifier(cur);
})
.onChanged(cur -> itemIds[5] = new Identifier(cur))
.build()
);
private final Setting<String> slot6 = slotsGroup.add(new StringSetting.Builder()
.name("slot6")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[6] = new Identifier(cur);
})
.onChanged(cur -> itemIds[6] = new Identifier(cur))
.build()
);
private final Setting<String> slot7 = slotsGroup.add(new StringSetting.Builder()
.name("slot7")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[7] = new Identifier(cur);
})
.onChanged(cur -> itemIds[7] = new Identifier(cur))
.build()
);
private final Setting<String> slot8 = slotsGroup.add(new StringSetting.Builder()
.name("slot8")
.defaultValue("")
.visible(() -> false)
.onChanged(cur -> {
itemIds[8] = new Identifier(cur);
})
.onChanged(cur -> itemIds[8] = new Identifier(cur))
.build()
);

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"depends": {
"java": ">=17",
"minecraft": "1.20.4",
"meteor-client": ">0.5.4"
"meteor-client": ">0.5.5"
}
}

0 comments on commit e8661bb

Please sign in to comment.