Changed overrides into operations. Added priority and isLast values to operations.
This commit is contained in:
@ -9,6 +9,7 @@ import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = XpTools.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
@ -50,30 +51,31 @@ public final class Config {
|
||||
|
||||
public static class Server {
|
||||
public static ForgeConfigSpec.BooleanValue blockBreakDefaultNoXp;
|
||||
private static ForgeConfigSpec.ConfigValue<List<? extends String>> blockBreakOverridesRaw;
|
||||
public static List<OverrideItem> blockBreakOverrideItems;
|
||||
private static ForgeConfigSpec.ConfigValue<List<? extends String>> blockBreakOperationsRaw;
|
||||
public static List<OperationItem> blockBreakOperationItems;
|
||||
|
||||
Server(ForgeConfigSpec.Builder builder) {
|
||||
builder.comment("Settings for block breaking").push("block_breaking");
|
||||
blockBreakDefaultNoXp = builder
|
||||
.comment("Should all blocks drop 0 XP by default?")
|
||||
.comment("(This makes multipliers not have any effect)")
|
||||
.define("blockBreakXpDisabled", false);
|
||||
blockBreakOverridesRaw = builder
|
||||
.comment("List of all overrides. Format: '[block_id/tag],[multi/val],[min],[max]'")
|
||||
.define("blockBreakDefaultNoXp", false);
|
||||
blockBreakOperationsRaw = builder
|
||||
.comment("List of all overrides. Format: '[block_id/tag],[operation],[min],[max],[priority],[is_last]'")
|
||||
.comment("Available operations: " + Arrays.toString(OperationType.values()))
|
||||
.comment("Examples:")
|
||||
.comment("'minecraft:dirt,val,2,2' - Makes minecraft's dirt blocks drop 2 XP")
|
||||
.comment("'#forge:ores,multi,1,2' - Applies an XP multiplier between 1-2 to all blocks tagged forge:ores")
|
||||
.define("blockBreakOverrides", new ArrayList<>());
|
||||
.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.")
|
||||
.define("blockBreakOperations", new ArrayList<>());
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerConfigReload(ModConfigEvent event) {
|
||||
if (event.getConfig().getSpec() == SERVER_SPEC) {
|
||||
blockBreakOverrideItems = new ArrayList<>();
|
||||
for (String s : blockBreakOverridesRaw.get()) {
|
||||
blockBreakOverrideItems.add(new OverrideItem(s));
|
||||
blockBreakOperationItems = new ArrayList<>();
|
||||
for (String s : blockBreakOperationsRaw.get()) {
|
||||
blockBreakOperationItems.add(new OperationItem(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user