Changed config option for no xp to a global operations list.
This commit is contained in:
@ -65,19 +65,23 @@ public final class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Server {
|
public static class Server {
|
||||||
public static ForgeConfigSpec.BooleanValue blockBreakDefaultNoXp;
|
private static ForgeConfigSpec.ConfigValue<List<? extends String>> blockBreakGlobalOperationsRaw;
|
||||||
|
public static List<GlobalOperationItem> blockBreakGlobalOperationItems;
|
||||||
private static ForgeConfigSpec.ConfigValue<List<? extends String>> blockBreakOperationsRaw;
|
private static ForgeConfigSpec.ConfigValue<List<? extends String>> blockBreakOperationsRaw;
|
||||||
public static List<OperationItem> blockBreakOperationItems;
|
public static List<OperationItem> blockBreakOperationItems;
|
||||||
|
|
||||||
Server(ForgeConfigSpec.Builder builder) {
|
Server(ForgeConfigSpec.Builder builder) {
|
||||||
|
builder.comment("Available operations: " + Arrays.toString(OperationType.values()));
|
||||||
|
|
||||||
builder.comment("Settings for block breaking").push("block_breaking");
|
builder.comment("Settings for block breaking").push("block_breaking");
|
||||||
blockBreakDefaultNoXp = builder
|
blockBreakGlobalOperationsRaw = builder
|
||||||
.comment("Should all blocks drop 0 XP by default?")
|
.comment("List of global operations. Format: '[operation],[min],[max],[priority]'")
|
||||||
.comment("(This makes multipliers not have any effect)")
|
.comment("Global operations are run before any unique operations.")
|
||||||
.define("blockBreakDefaultNoXp", false);
|
.comment("Examples:")
|
||||||
|
.comment("'set,0,0,0' - Sets the xp of all blocks to 0.")
|
||||||
|
.define("blockBreakGlobalOperations", new ArrayList<>());
|
||||||
blockBreakOperationsRaw = builder
|
blockBreakOperationsRaw = builder
|
||||||
.comment("List of all overrides. Format: '[block_id/tag],[operation],[min],[max],[priority],[is_last]'")
|
.comment("List of unique operations. Format: '[block_id/tag_id],[operation],[min],[max],[priority],[is_last]'")
|
||||||
.comment("Available operations: " + Arrays.toString(OperationType.values()))
|
|
||||||
.comment("Examples:")
|
.comment("Examples:")
|
||||||
.comment("'minecraft:dirt,set,2,2,0,true' - Sets the xp drop of the dirt block to 2, takes highest priority and stops any additional operations.")
|
.comment("'minecraft:dirt,set,2,2,0,true' - Sets the xp drop of the dirt block to 2, takes highest priority and stops any additional operations.")
|
||||||
.comment("'#forge:ores,multiply,1,2,1,false' - Multiplies xp drop of all blocks tagged forge:ores by 1-2, allows additional operations.")
|
.comment("'#forge:ores,multiply,1,2,1,false' - Multiplies xp drop of all blocks tagged forge:ores by 1-2, allows additional operations.")
|
||||||
@ -86,6 +90,13 @@ public final class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void onConfigReload() {
|
private static void onConfigReload() {
|
||||||
|
// Parse all block break global operations
|
||||||
|
blockBreakGlobalOperationItems = new ArrayList<>();
|
||||||
|
for (String s : blockBreakGlobalOperationsRaw.get()) {
|
||||||
|
blockBreakOperationItems.add(GlobalOperationItem.fromConfig(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse all block break unique operations
|
||||||
blockBreakOperationItems = new ArrayList<>();
|
blockBreakOperationItems = new ArrayList<>();
|
||||||
for (String s : blockBreakOperationsRaw.get()) {
|
for (String s : blockBreakOperationsRaw.get()) {
|
||||||
blockBreakOperationItems.add(OperationItem.fromConfig(s));
|
blockBreakOperationItems.add(OperationItem.fromConfig(s));
|
||||||
|
Reference in New Issue
Block a user