using config for items, could not think of another solution for now

This commit is contained in:
NK 2023-02-21 15:57:36 +00:00
parent 7e3b3c9c2a
commit d80acf088c
5 changed files with 32 additions and 11 deletions

View file

@ -21,7 +21,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.github.johnrengelman.shadow" apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "org.spongepowered.mixin" apply plugin: "org.spongepowered.mixin"
version = "1.0.0" version = "1.0.1-beta"
group = "me.night0721.lilase" group = "me.night0721.lilase"
archivesBaseName = "Lilase" archivesBaseName = "Lilase"
sourceCompatibility = 1.8 sourceCompatibility = 1.8
@ -36,7 +36,7 @@ minecraft {
replace "@VERSION@": project.version replace "@VERSION@": project.version
clientRunArgs += ["--tweakClass gg.essential.loader.stage0.EssentialSetupTweaker cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker", "--mixin mixins.night0721.json"] clientRunArgs += ["--tweakClass cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker", "--mixin mixins.night0721.json"]
} }
configurations { configurations {

View file

@ -6,7 +6,7 @@ import cc.polyfrost.oneconfig.config.annotations.Slider;
import cc.polyfrost.oneconfig.config.annotations.Text; import cc.polyfrost.oneconfig.config.annotations.Text;
import cc.polyfrost.oneconfig.config.data.Mod; import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.config.data.ModType; import cc.polyfrost.oneconfig.config.data.ModType;
import me.night0721.lilase.gui.ConfigGUI; import me.night0721.lilase.gui.CoordinateGUI;
import me.night0721.lilase.utils.ConfigUtils; import me.night0721.lilase.utils.ConfigUtils;
public class AHConfig extends Config { public class AHConfig extends Config {
@ -18,7 +18,8 @@ public class AHConfig extends Config {
} }
@HUD(name = "Lilase") @HUD(name = "Lilase")
public ConfigGUI hud = new ConfigGUI(); public CoordinateGUI hud = new CoordinateGUI();
@Slider(name = "Time per fetch (seconds)", min = 5, max = 15, step = 1) @Slider(name = "Time per fetch (seconds)", min = 5, max = 15, step = 1)
public static int AUCTION_HOUSE_DELAY = 5; public static int AUCTION_HOUSE_DELAY = 5;

View file

@ -36,10 +36,17 @@ public class AuctionHouse {
public static States clickState = States.NONE; public static States clickState = States.NONE;
public AuctionHouse() { public AuctionHouse() {
// items.add(new Item("Livid Dagger", ItemType.WEAPON, 8000000, ItemTier.LEGENDARY)); // items.add(new Item("Livid Dagger", ItemType.WEAPON, 8000000, ItemTier.LEGENDARY));
// items.add(new Item("Aspect of the Void", ItemType.WEAPON, 8000000, ItemTier.EPIC)); // items.add(new Item("Aspect of the Void", ItemType.WEAPON, 8000000, ItemTier.EPIC));
// items.add(new Item("Bal", ItemType.MISC, 10000000, ItemTier.EPIC)); // items.add(new Item("Bal", ItemType.MISC, 10000000, ItemTier.EPIC));
items.add(new Item(" ", ItemType.ANY, 1000, ItemTier.ANY)); // items.add(new Item(" ", ItemType.ANY, 1000, ItemTier.ANY));
if (ConfigUtils.getString("item1", "Name") != "")
items.add(new Item(ConfigUtils.getString("item1", "Name"), ItemType.valueOf(ConfigUtils.getString("item1", "Type")), ConfigUtils.getInt("item1", "Price"), ItemTier.valueOf(ConfigUtils.getString("item1", "Tier"))));
if (ConfigUtils.getString("item2", "Name") != "")
items.add(new Item(ConfigUtils.getString("item2", "Name"), ItemType.valueOf(ConfigUtils.getString("item2", "Type")), ConfigUtils.getInt("item2", "Price"), ItemTier.valueOf(ConfigUtils.getString("item2", "Tier"))));
if (ConfigUtils.getString("item3", "Name") != "")
items.add(new Item(ConfigUtils.getString("item3", "Name"), ItemType.valueOf(ConfigUtils.getString("item3", "Type")), ConfigUtils.getInt("item3", "Price"), ItemTier.valueOf(ConfigUtils.getString("item3", "Tier"))));
webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook")); webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
webhook.setUsername("Lilase - Auction House"); webhook.setUsername("Lilase - Auction House");
webhook.setAvatarUrl("https://wallpapercave.com/wp/wp2412537.jpg"); webhook.setAvatarUrl("https://wallpapercave.com/wp/wp2412537.jpg");

View file

@ -5,9 +5,9 @@ import me.night0721.lilase.utils.PlayerUtils;
import java.util.List; import java.util.List;
public class ConfigGUI extends TextHud { public class CoordinateGUI extends TextHud {
public ConfigGUI() { public CoordinateGUI() {
super(true, 0, 0); super(true, 0, 0);
} }
@Override @Override
@ -17,6 +17,5 @@ public class ConfigGUI extends TextHud {
lines.add("Y: " + Math.round(PlayerUtils.mc.thePlayer.posY)); lines.add("Y: " + Math.round(PlayerUtils.mc.thePlayer.posY));
lines.add("Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ)); lines.add("Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ));
// get the time in real life and format it to xx:xx, eg 23:54 // get the time in real life and format it to xx:xx, eg 23:54
} }
} }

View file

@ -8,14 +8,28 @@ import java.io.File;
public class ConfigUtils { public class ConfigUtils {
public static Configuration config; public static Configuration config;
public final static String file = "config/Lilase.cfg"; public final static String file = "config/Lilase.cfg";
public static void register() { public static void register() {
init(); init();
reloadConfig(); reloadConfig();
} }
public static void reloadConfig() { public static void reloadConfig() {
if (!hasKey("main", "APIKey")) writeStringConfig("main", "APIKey", ""); if (!hasKey("main", "APIKey")) writeStringConfig("main", "APIKey", "");
if (!hasKey("main", "Webhook")) writeStringConfig("main", "Webhook", ""); if (!hasKey("main", "Webhook")) writeStringConfig("main", "Webhook", "");
if (!hasKey("main", "AuctionHouseDelay")) writeIntConfig("main", "AuctionHouseDelay", 8); if (!hasKey("main", "AuctionHouseDelay")) writeIntConfig("main", "AuctionHouseDelay", 8);
if (!hasKey("item1", "Name")) writeStringConfig("item1", "Name", "");
if (!hasKey("item1", "Type")) writeStringConfig("item1", "Type", "");
if (!hasKey("item1", "Price")) writeIntConfig("item1", "Price", 0);
if (!hasKey("item1", "Tier")) writeStringConfig("item1", "Tier", "");
if (!hasKey("item2", "Name")) writeStringConfig("item2", "Name", "");
if (!hasKey("item2", "Type")) writeStringConfig("item2", "Type", "");
if (!hasKey("item2", "Price")) writeIntConfig("item2", "Price", 0);
if (!hasKey("item2", "Tier")) writeStringConfig("item2", "Tier", "");
if (!hasKey("item3", "Name")) writeStringConfig("item3", "Name", "");
if (!hasKey("item3", "Type")) writeStringConfig("item3", "Type", "");
if (!hasKey("item3", "Price")) writeIntConfig("item3", "Price", 0);
if (!hasKey("item3", "Tier")) writeStringConfig("item3", "Tier", "");
} }
public static void init() { public static void init() {