Added config options for operations.
This commit is contained in:
@ -76,6 +76,11 @@ public final class Config {
|
|||||||
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;
|
||||||
|
|
||||||
|
private static ForgeConfigSpec.ConfigValue<List<? extends String>> entityKillGlobalOperationsRaw;
|
||||||
|
public static List<GlobalOperationItem> entityKillGlobalOperationItems;
|
||||||
|
private static ForgeConfigSpec.ConfigValue<List<? extends String>> entityKillOperationsRaw;
|
||||||
|
public static List<OperationItem> entityKillOperationItems;
|
||||||
|
|
||||||
Server(ForgeConfigSpec.Builder builder) {
|
Server(ForgeConfigSpec.Builder builder) {
|
||||||
builder.comment("Settings for debugging").push("debug");
|
builder.comment("Settings for debugging").push("debug");
|
||||||
debugExtra = builder
|
debugExtra = builder
|
||||||
@ -105,6 +110,21 @@ public final class Config {
|
|||||||
.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.")
|
||||||
.define("blockBreakOperations", new ArrayList<>());
|
.define("blockBreakOperations", new ArrayList<>());
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
||||||
|
builder.comment("Settings for entity killing").push("entity_killing");
|
||||||
|
builder.comment("Available operations: " + Arrays.toString(OperationType.values()));
|
||||||
|
entityKillGlobalOperationsRaw = builder
|
||||||
|
.comment("List of global operations. Format: '[operation],[min],[max],[priority]'")
|
||||||
|
.comment("Global operations are run before any unique operations.")
|
||||||
|
.comment("Examples:")
|
||||||
|
.comment("'set,0,0,0' - Sets the xp of all blocks to 0.")
|
||||||
|
.define("entityKillGlobalOperations", new ArrayList<>());
|
||||||
|
entityKillOperationsRaw = builder
|
||||||
|
.comment("List of unique operations. Format: '[entity_id],[operation],[min],[max],[priority],[is_last]'")
|
||||||
|
.comment("Examples:")
|
||||||
|
.comment("'minecraft:creeper,set,2,2,0,true' - Sets the xp drop for killing creepers to 2, takes highest priority and stops any additional operations.")
|
||||||
|
.define("entityKillOperations", new ArrayList<>());
|
||||||
|
builder.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void onConfigReload() {
|
private static void onConfigReload() {
|
||||||
@ -123,6 +143,19 @@ public final class Config {
|
|||||||
for (String s : blockBreakOperationsRaw.get()) {
|
for (String s : blockBreakOperationsRaw.get()) {
|
||||||
blockBreakOperationItems.add(OperationItem.fromConfig(s));
|
blockBreakOperationItems.add(OperationItem.fromConfig(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse all entity kill global operations
|
||||||
|
entityKillGlobalOperationItems = new ArrayList<>();
|
||||||
|
for (String s : entityKillGlobalOperationsRaw.get()) {
|
||||||
|
entityKillGlobalOperationItems.add(GlobalOperationItem.fromConfig(s));
|
||||||
|
}
|
||||||
|
entityKillGlobalOperationItems.sort(Comparator.comparingInt(OperationItem::getPriority));
|
||||||
|
|
||||||
|
// Parse all entity kill unique operations
|
||||||
|
entityKillOperationItems = new ArrayList<>();
|
||||||
|
for (String s : entityKillOperationsRaw.get()) {
|
||||||
|
entityKillOperationItems.add(OperationItem.fromConfig(s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user