Skip to content

Commit

Permalink
Add /gfs Ender Pearl keybind
Browse files Browse the repository at this point in the history
  • Loading branch information
bowser0000 committed Mar 25, 2024
1 parent 4352446 commit 526156c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/main/java/me/Danker/config/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import cc.polyfrost.oneconfig.config.data.OptionSize;
import cc.polyfrost.oneconfig.config.migration.CfgMigrator;
import cc.polyfrost.oneconfig.config.migration.CfgName;
import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
import cc.polyfrost.oneconfig.utils.Notifications;
import me.Danker.DankersSkyblockMod;
import me.Danker.features.*;
Expand Down Expand Up @@ -43,6 +42,7 @@ public ModConfig() {
initialize();

registerKeyBind(maddoxKey, FasterMaddoxCalling::onKey);
registerKeyBind(pearlKey, GetPearlFromSack::onKey);
registerKeyBind(abilityKey, DankersSkyblockMod::onAbilityKey);
registerKeyBind(waypointKey, CrystalHollowWaypoints::onKey);
registerKeyBind(skillTrackerKey, SkillTracker::onKey);
Expand Down Expand Up @@ -2185,40 +2185,56 @@ public static int toDisplay(String value) {

// Keybinds

@KeyBind(
name = "Get Pearl From Sack",
category = "Keybinds",
subcategory = "General"
)
public static OneKeyBind pearlKey = new OneKeyBind();

@Number(
name = "Amount of Pearls",
description = "Amount of pearls to top up to.",
min = 1, max = 560,
category = "Keybinds",
subcategory = "General"
)
public static int pearlAmount = 16;

@KeyBind(
name = "Open Maddox Menu",
category = "Keybinds",
subcategory = "General"
)
public static OneKeyBind maddoxKey = new OneKeyBind(UKeyboard.KEY_M);
public static OneKeyBind maddoxKey = new OneKeyBind();

@KeyBind(
name = "Regular Ability",
category = "Keybinds",
subcategory = "Dungeons"
)
public static OneKeyBind abilityKey = new OneKeyBind(UKeyboard.KEY_NUMPAD4);
public static OneKeyBind abilityKey = new OneKeyBind();

@KeyBind(
name = "Create Waypoint",
category = "Keybinds",
subcategory = "Waypoints"
)
public static OneKeyBind waypointKey = new OneKeyBind(UKeyboard.KEY_NUMPAD6);
public static OneKeyBind waypointKey = new OneKeyBind();

@KeyBind(
name = "Start/Stop Skill Tracker",
category = "Keybinds",
subcategory = "Trackers"
)
public static OneKeyBind skillTrackerKey = new OneKeyBind(UKeyboard.KEY_NUMPAD5);
public static OneKeyBind skillTrackerKey = new OneKeyBind();

@KeyBind(
name = "Start/Stop Powder Tracker",
category = "Keybinds",
subcategory = "Trackers"
)
public static OneKeyBind powderTrackerKey = new OneKeyBind(UKeyboard.KEY_NUMPAD8);
public static OneKeyBind powderTrackerKey = new OneKeyBind();

@KeyBind(
name = "Disable Mouse Movement",
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/me/Danker/features/GetPearlFromSack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package me.Danker.features;

import me.Danker.config.ModConfig;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.item.ItemStack;

public class GetPearlFromSack {

public static void onKey() {
if (!Utils.inSkyblock) return;

EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
ItemStack[] inv = player.inventory.mainInventory;
int amountOfPearls = 0;

for (ItemStack stack : inv) {
if (stack == null) continue;

String id = Utils.getSkyblockItemID(stack);
if (id == null) continue;

if (id.equals("ENDER_PEARL")) amountOfPearls += stack.stackSize;
}

if (amountOfPearls >= ModConfig.pearlAmount) return;
player.sendChatMessage("/gfs Ender Pearl " + (ModConfig.pearlAmount - amountOfPearls));
}

}

0 comments on commit 526156c

Please sign in to comment.