Removed unused Client and Common configs. Removed future totems for now. Updated TotemConfig class.
This commit is contained in:
@ -1,42 +1,21 @@
|
|||||||
package dev.micle.totemofreviving.config;
|
package dev.micle.totemofreviving.config;
|
||||||
|
|
||||||
|
import dev.micle.totemofreviving.item.StrawTotemItem;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public final class Config {
|
public final class Config {
|
||||||
public static void init() {
|
public static void init() {
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Common.spec);
|
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Server.SPEC);
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Client.spec);
|
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Server.spec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Common {
|
public static final class Server {
|
||||||
static ForgeConfigSpec spec = null;
|
private static final ForgeConfigSpec SPEC;
|
||||||
|
|
||||||
Common() {
|
private static final TotemConfig STRAW_TOTEM_CONFIG;
|
||||||
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
|
||||||
spec = builder.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Client {
|
static {
|
||||||
static ForgeConfigSpec spec = null;
|
|
||||||
|
|
||||||
Client() {
|
|
||||||
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
|
||||||
spec = builder.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class Server {
|
|
||||||
static ForgeConfigSpec spec;
|
|
||||||
|
|
||||||
public static final HashMap<String, TotemConfig> TOTEM_CONFIGS = new HashMap<>();
|
|
||||||
|
|
||||||
Server() {
|
|
||||||
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
||||||
/*
|
/*
|
||||||
Straw Totem
|
Straw Totem
|
||||||
@ -53,31 +32,29 @@ public final class Config {
|
|||||||
Glowstone Totem
|
Glowstone Totem
|
||||||
Netherite Totem
|
Netherite Totem
|
||||||
*/
|
*/
|
||||||
TOTEM_CONFIGS.put("Straw Totem", new TotemConfig("Straw Totem", builder,
|
STRAW_TOTEM_CONFIG = new TotemConfig(builder, StrawTotemItem.getName(),
|
||||||
true, -1, 3, 1, false, 3));
|
true, -1, 3, 1, false, 3);
|
||||||
TOTEM_CONFIGS.put("Iron Totem", new TotemConfig("Iron Totem", builder,
|
|
||||||
true, -1, 6, 0.75, false, 10));
|
|
||||||
TOTEM_CONFIGS.put("Diamond Totem", new TotemConfig("Diamond Totem", builder,
|
|
||||||
true, -1, 0, 0.5, false, 50));
|
|
||||||
|
|
||||||
spec = builder.build();
|
SPEC = builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TotemConfig {
|
public static TotemConfig getStrawTotemConfig() { return STRAW_TOTEM_CONFIG; }
|
||||||
public final String NAME;
|
}
|
||||||
public final ForgeConfigSpec.BooleanValue IS_ENABLED;
|
|
||||||
public final ForgeConfigSpec.IntValue CHARGE_COST;
|
|
||||||
public final ForgeConfigSpec.IntValue CHARGE_COST_LIMIT;
|
|
||||||
public final ForgeConfigSpec.DoubleValue CHARGE_COST_MULTIPLIER;
|
|
||||||
public final ForgeConfigSpec.BooleanValue CAN_REVIVE_MORE_EXPENSIVE_TARGETS;
|
|
||||||
public final ForgeConfigSpec.IntValue DURABILITY;
|
|
||||||
|
|
||||||
TotemConfig(String totemName, ForgeConfigSpec.Builder builder, boolean isEnabled, int chargeCost, int chargeCostLimit,
|
public static class TotemConfig {
|
||||||
double chargeCostMultiplier, boolean canReviveMoreExpensiveTargets, int durability) {
|
private final ForgeConfigSpec.BooleanValue IS_ENABLED;
|
||||||
NAME = totemName;
|
private final ForgeConfigSpec.IntValue CHARGE_COST;
|
||||||
builder.push(NAME);
|
private final ForgeConfigSpec.IntValue CHARGE_COST_LIMIT;
|
||||||
|
private final ForgeConfigSpec.DoubleValue CHARGE_COST_MULTIPLIER;
|
||||||
|
private final ForgeConfigSpec.BooleanValue CAN_REVIVE_MORE_EXPENSIVE_TARGETS;
|
||||||
|
private final ForgeConfigSpec.IntValue DURABILITY;
|
||||||
|
|
||||||
|
TotemConfig(ForgeConfigSpec.Builder builder, String name, boolean isEnabled, int chargeCost,
|
||||||
|
int chargeCostLimit, double chargeCostMultiplier, boolean canReviveMoreExpensiveTargets,
|
||||||
|
int durability) {
|
||||||
|
builder.push(name);
|
||||||
IS_ENABLED = builder
|
IS_ENABLED = builder
|
||||||
.comment("Is the " + NAME + " enabled?")
|
.comment("Is the " + name + " enabled?")
|
||||||
.define("isEnabled", isEnabled);
|
.define("isEnabled", isEnabled);
|
||||||
CHARGE_COST = builder
|
CHARGE_COST = builder
|
||||||
.comment("The charge cost to revive a player.\n" +
|
.comment("The charge cost to revive a player.\n" +
|
||||||
@ -100,6 +77,12 @@ public final class Config {
|
|||||||
.defineInRange("durability", durability, 0, Integer.MAX_VALUE);
|
.defineInRange("durability", durability, 0, Integer.MAX_VALUE);
|
||||||
builder.pop();
|
builder.pop();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public boolean getIsEnabled() { return IS_ENABLED.get(); }
|
||||||
|
public int getChargeCost() { return CHARGE_COST.get(); }
|
||||||
|
public int getChargeCostLimit() { return CHARGE_COST_LIMIT.get(); }
|
||||||
|
public double getChargeCostMultiplier() { return CHARGE_COST_MULTIPLIER.get(); }
|
||||||
|
public boolean getCanReviveMoreExpensiveTargets() { return CAN_REVIVE_MORE_EXPENSIVE_TARGETS.get(); }
|
||||||
|
public int getDurability() { return DURABILITY.get(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user