diff --git a/common/src/main/java/muramasa/antimatter/blockentity/BlockEntityMachine.java b/common/src/main/java/muramasa/antimatter/blockentity/BlockEntityMachine.java index b83e39e6d..16bb118ce 100644 --- a/common/src/main/java/muramasa/antimatter/blockentity/BlockEntityMachine.java +++ b/common/src/main/java/muramasa/antimatter/blockentity/BlockEntityMachine.java @@ -376,7 +376,7 @@ public Tier getPowerLevel() { return getMachineTier(); } - public boolean has(MachineFlag flag) { + public boolean has(String flag) { return getMachineType().has(flag); } diff --git a/common/src/main/java/muramasa/antimatter/integration/kubejs/AMCreationEvent.java b/common/src/main/java/muramasa/antimatter/integration/kubejs/AMCreationEvent.java index 777a828d6..f08b1ba0e 100644 --- a/common/src/main/java/muramasa/antimatter/integration/kubejs/AMCreationEvent.java +++ b/common/src/main/java/muramasa/antimatter/integration/kubejs/AMCreationEvent.java @@ -75,10 +75,6 @@ public void addFlagsToMaterial(String materialId, String... flags) { } } - public MachineFlag machineFlag(String id){ - return MachineFlag.valueOf(id); - } - public MaterialType type(String type) { return AntimatterAPI.get(MaterialType.class, type); } diff --git a/common/src/main/java/muramasa/antimatter/machine/MachineFlag.java b/common/src/main/java/muramasa/antimatter/machine/MachineFlag.java index 1c6824f03..6080462ab 100644 --- a/common/src/main/java/muramasa/antimatter/machine/MachineFlag.java +++ b/common/src/main/java/muramasa/antimatter/machine/MachineFlag.java @@ -11,27 +11,21 @@ import java.util.Set; import java.util.stream.Collectors; -public enum MachineFlag { - - BASIC, // - STEAM, - MULTI, //Has structure - HATCH, - ITEM, //Can store items - CELL, - FLUID, - EU, //Needs power - RF, //Uses RF instead of EU - HEAT, - RECIPE, //Has a recipe map - GUI, - GENERATOR, //Has a recipe map and converts applicable recipes to power. - COVERABLE, - PARTIAL_AMPS, - UNCULLED; - - @Override - public String toString() { - return super.toString().toLowerCase(); - } +public final class MachineFlag { + public static final String BASIC = "basic"; // + public static final String STEAM = "steam"; + public static final String MULTI = "multi"; //Has structure + public static final String HATCH = "hatch"; + public static final String ITEM = "item"; //Can store items + public static final String CELL = "cell"; + public static final String FLUID = "fluid"; + public static final String EU = "eu"; //Needs power + public static final String RF = "rf"; //Uses RF instead of EU + public static final String HEAT = "heat"; + public static final String RECIPE = "recipe"; //Has a recipe map + public static final String GUI = "gui"; + public static final String GENERATOR = "generator"; //Has a recipe map and converts applicable recipes to power. + public static final String COVERABLE = "coverable"; + public static final String PARTIAL_AMPS = "partial_amps"; + public static final String UNCULLED = "unculled"; } diff --git a/common/src/main/java/muramasa/antimatter/machine/types/Machine.java b/common/src/main/java/muramasa/antimatter/machine/types/Machine.java index 00acee184..3c6c6cd57 100644 --- a/common/src/main/java/muramasa/antimatter/machine/types/Machine.java +++ b/common/src/main/java/muramasa/antimatter/machine/types/Machine.java @@ -612,13 +612,6 @@ public IRecipeMap getRecipeMap(Tier tier) { return tierRecipeMaps.get(""); } - public T addFlags(MachineFlag... flags) { - for (MachineFlag flag : flags) { - FLAG_MAP.computeIfAbsent(flag.toString(), s -> new ObjectOpenHashSet<>()).add(this); - } - return (T) this; - } - public T addFlags(String... flags) { for (String flag : flags) { FLAG_MAP.computeIfAbsent(flag, s -> new ObjectOpenHashSet<>()).add(this); @@ -626,13 +619,6 @@ public T addFlags(String... flags) { return (T) this; } - public T removeFlags(MachineFlag... flags) { - for (MachineFlag flag : flags) { - FLAG_MAP.computeIfAbsent(flag.toString(), s -> new ObjectOpenHashSet<>()).remove(this); - } - return (T) this; - } - public T removeFlags(String... flags) { for (String flag : flags) { FLAG_MAP.computeIfAbsent(flag, s -> new ObjectOpenHashSet<>()).remove(this); @@ -640,7 +626,7 @@ public T removeFlags(String... flags) { return (T) this; } - public void setFlags(MachineFlag... flags) { + public void setFlags(String... flags) { FLAG_MAP.forEach((s, m) -> m.remove(this)); addFlags(flags); } @@ -725,16 +711,6 @@ public boolean hasTierSpecificLang(){ return tierSpecificLang; } - /** - * Whether or not this machine has the given machine flag. - * - * @param flag the flag. - * @return if it has it;. - */ - public boolean has(MachineFlag flag) { - return has(flag.toString()); - } - /** * Whether or not this machine has the given machine flag. * @@ -772,11 +748,11 @@ public static Optional> get(String name, String domain) { return Optional.ofNullable(machine); } - public static Collection> getTypes(MachineFlag... flags) { + public static Collection> getTypes(String... flags) { List> types = new ObjectArrayList<>(); - for (MachineFlag flag : flags) { - if (FLAG_MAP.containsKey(flag.toString())){ - types.addAll(FLAG_MAP.get(flag.toString())); + for (var flag : flags) { + if (FLAG_MAP.containsKey(flag)){ + types.addAll(FLAG_MAP.get(flag)); } }