aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-03-14 14:22:00 +0800
committerGitHub <noreply@github.com>2022-03-14 07:22:00 +0100
commitb9de712dcfb935861059cb92a60c0d698cd302d4 (patch)
tree31604150a39489651071e15d52d72e07d8fbbd04
parent34a94189cf413164d2364dad26325688bc8128e6 (diff)
downloadGT5-Unofficial-b9de712dcfb935861059cb92a60c0d698cd302d4.tar.gz
GT5-Unofficial-b9de712dcfb935861059cb92a60c0d698cd302d4.tar.bz2
GT5-Unofficial-b9de712dcfb935861059cb92a60c0d698cd302d4.zip
pin comb type id instead of depending on array ordinal (#980)
* pin comb type id instead of depending on array ordinal * fix up _NULL related problems * fix out of bound * make it private * add some more test
-rw-r--r--addon.gradle6
-rw-r--r--dependencies.gradle6
-rw-r--r--src/main/java/gregtech/GT_Mod.java25
-rw-r--r--src/main/java/gregtech/api/GregTech_API.java14
-rw-r--r--src/main/java/gregtech/common/items/CombType.java312
-rw-r--r--src/main/java/gregtech/common/items/ItemComb.java42
-rw-r--r--src/test/java/gregtech/common/items/CombTypeTest.java43
7 files changed, 265 insertions, 183 deletions
diff --git a/addon.gradle b/addon.gradle
new file mode 100644
index 0000000000..2ac5925913
--- /dev/null
+++ b/addon.gradle
@@ -0,0 +1,6 @@
+test {
+ useJUnitPlatform()
+ testLogging {
+ events "passed", "skipped", "failed"
+ }
+}
diff --git a/dependencies.gradle b/dependencies.gradle
index 6a61c1021d..1faed6f515 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -66,7 +66,7 @@ dependencies {
transitive = false
}
annotationProcessor("com.google.auto.value:auto-value:1.8.2")
- //runtime('com.github.GTNewHorizons:bartworks:0.5.36:dev') {
- // exclude group:'com.github.GTNewHorizons', module:'GT5-Unofficial'
- //}
+
+ testImplementation(platform('org.junit:junit-bom:5.8.2'))
+ testImplementation('org.junit.jupiter:junit-jupiter')
}
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java
index 768fe4ceae..165ec23297 100644
--- a/src/main/java/gregtech/GT_Mod.java
+++ b/src/main/java/gregtech/GT_Mod.java
@@ -53,12 +53,15 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.*;
import java.util.*;
+import java.util.function.Predicate;
+import static gregtech.api.GregTech_API.registerCircuitProgrammer;
import static gregtech.api.enums.GT_Values.MOD_ID_FR;
@SuppressWarnings("ALL")
@@ -247,6 +250,18 @@ public class GT_Mod implements IGT_Mod {
}
gregtechproxy.onLoad();
+
+ registerCircuitProgrammer(new Predicate<ItemStack>() {
+ private final int screwdriverOreId = OreDictionary.getOreID("craftingToolScrewdriver");
+ @Override
+ public boolean test(ItemStack stack) {
+ for (int i : OreDictionary.getOreIDs(stack))
+ if (i == screwdriverOreId)
+ return true;
+ return false;
+ }
+ }, true);
+
if (gregtechproxy.mSortToTheEnd) {
new GT_ItemIterator().run();
gregtechproxy.registerUnificationEntries();
@@ -292,7 +307,7 @@ public class GT_Mod implements IGT_Mod {
GT_Log.out.println("META " + i + " " + GregTech_API.METATILEENTITIES[i].getMetaName());
}
}
-
+
if (gregtechproxy.mSortToTheEnd) {
gregtechproxy.registerUnificationEntries();
} else {
@@ -343,7 +358,7 @@ public class GT_Mod implements IGT_Mod {
}
GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item("machine", 1L));
GT_ModHandler.addCraftingRecipe(GT_ModHandler.getIC2Item("machine", 1L), GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "RwR", "RRR", 'R', OrePrefixes.plate.get(Materials.Iron)});
-
+
GT_PostLoad.registerFluidCannerRecipes();
if (Loader.isModLoaded(MOD_ID_FR)) {
@@ -375,7 +390,7 @@ public class GT_Mod implements IGT_Mod {
MinecraftForge.EVENT_BUS.register(new GT_TooltipEventHandler());
GT_LanguageManager.propagateLocalizationServerSide();
- /*
+ /*
* Until this point most crafting recipe additions, and removals, have been buffered.
* Go through, execute the removals in bulk, and then any deferred additions. The bulk removals in particular significantly speed up the recipe list
* modifications.
@@ -385,7 +400,7 @@ public class GT_Mod implements IGT_Mod {
GT_Log.out.println("GT_Mod: Adding buffered Recipes.");
GT_ModHandler.stopBufferingCraftingRecipes();
GT_FML_LOGGER.info("Executed delayed Crafting Recipes (" + stopwatch.stop() + "). Have a Cake.");
-
+
GT_Log.out.println("GT_Mod: Saving Lang File.");
GT_LanguageManager.sEnglishFile.save();
GregTech_API.sPostloadFinished = true;
@@ -424,7 +439,7 @@ public class GT_Mod implements IGT_Mod {
GregTech_API.sAfterGTLoad = null;
GregTech_API.sBeforeGTPostload = null;
GregTech_API.sAfterGTPostload = null;
-
+
GT_PostLoad.createGTtoolsCreativeTab();
}
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java
index 980eab18de..d38c9181dd 100644
--- a/src/main/java/gregtech/api/GregTech_API.java
+++ b/src/main/java/gregtech/api/GregTech_API.java
@@ -40,7 +40,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.Collection;
@@ -194,18 +193,7 @@ public class GregTech_API {
private static final Map<Integer, List<ItemStack>> sConfigurationLists = new HashMap<>();
private static final Map<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> sRealCircuitProgrammerList = new LinkedHashMap<>();
public static final Map<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> sCircuitProgrammerList = Collections.unmodifiableMap(sRealCircuitProgrammerList);
- static {
- registerCircuitProgrammer(new Predicate<ItemStack>() {
- private final int screwdriverOreId = OreDictionary.getOreID("craftingToolScrewdriver");
- @Override
- public boolean test(ItemStack stack) {
- for (int i : OreDictionary.getOreIDs(stack))
- if (i == screwdriverOreId)
- return true;
- return false;
- }
- }, true);
- }
+
/**
* The List of Dimensions, which are Whitelisted for the Teleporter. This list should not contain other Planets.
* Mystcraft Dimensions and other Dimensional Things should be allowed.
diff --git a/src/main/java/gregtech/common/items/CombType.java b/src/main/java/gregtech/common/items/CombType.java
index 2c86306676..484221f168 100644
--- a/src/main/java/gregtech/common/items/CombType.java
+++ b/src/main/java/gregtech/common/items/CombType.java
@@ -3,180 +3,194 @@ package gregtech.common.items;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_LanguageManager;
+import java.util.Arrays;
+
public enum CombType {
//Organic Line
- LIGNIE("lignite", true, Materials.Lignite, 100,0x58300B, 0x906237),
- COAL("coal", true, Materials.Coal, 100,0x525252, 0x666666),
- STICKY("stickyresin", true, Materials._NULL, 50,0x2E8F5B, 0xDCC289),
- OIL("oil", true, Materials._NULL, 100,0x333333, 0x4C4C4C),
- APATITE("apatite", true, Materials.Apatite, 100,0xc1c1f6, 0x676784),
- ASH("ash", true, Materials.Ash, 100,0x1e1a18, 0xc6c6c6),
+ LIGNIE(0, "lignite", true, Materials.Lignite, 100, 0x58300B, 0x906237),
+ COAL(1, "coal", true, Materials.Coal, 100, 0x525252, 0x666666),
+ STICKY(2, "stickyresin", true, Materials._NULL, 50, 0x2E8F5B, 0xDCC289),
+ OIL(3, "oil", true, Materials._NULL, 100, 0x333333, 0x4C4C4C),
+ APATITE(4, "apatite", true, Materials.Apatite, 100, 0xc1c1f6, 0x676784),
+ ASH(5, "ash", true, Materials.Ash, 100, 0x1e1a18, 0xc6c6c6),
//IC2 Line
- COOLANT("coolant", true, Materials._NULL, 100,0x144F5A, 0x2494A2),
- ENERGY("energy", true, Materials._NULL, 80,0xC11F1F, 0xEBB9B9),
- LAPOTRON("lapotron", true, Materials._NULL, 60,0x1414FF, 0x6478FF),
- PYROTHEUM("pyrotheum", true, Materials.Pyrotheum, 50,0xffebc4, 0xe36400),
- CRYOTHEUM("cryotheum", true, Materials.Pyrotheum, 50,0x2660ff, 0x5af7ff),
+ COOLANT(6, "coolant", true, Materials._NULL, 100, 0x144F5A, 0x2494A2),
+ ENERGY(7, "energy", true, Materials._NULL, 80, 0xC11F1F, 0xEBB9B9),
+ LAPOTRON(8, "lapotron", true, Materials._NULL, 60, 0x1414FF, 0x6478FF),
+ PYROTHEUM(9, "pyrotheum", true, Materials.Pyrotheum, 50, 0xffebc4, 0xe36400),
+ CRYOTHEUM(10, "cryotheum", true, Materials.Pyrotheum, 50, 0x2660ff, 0x5af7ff),
//Alloy Line
- REDALLOY("redalloy", true, Materials.RedAlloy, 100,0xE60000, 0xB80000),
- REDSTONEALLOY("redstonealloy", true, Materials.RedstoneAlloy, 90,0xB80000, 0xA50808),
- CONDUCTIVEIRON("conductiveiron", true, Materials.ConductiveIron, 80,0x817671, 0xCEADA3),
- VIBRANTALLOY("vibrantalloy", true, Materials.VibrantAlloy, 50,0x86A12D, 0xC4F2AE),
- ENERGETICALLOY("energeticalloy", true, Materials.EnergeticAlloy, 70,0xFF9933, 0xFFAD5C),
- ELECTRICALSTEEL("electricalsteel", true, Materials.ElectricalSteel, 90,0x787878, 0xD8D8D8),
- DARKSTEEL("darksteel", true, Materials.DarkSteel, 80,0x252525, 0x443B44),
- PULSATINGIRON("pulsatingiron", true, Materials.PulsatingIron, 80,0x006600, 0x6DD284),
- STAINLESSSTEEL("stainlesssteel", true, Materials.StainlessSteel, 75,0x778899, 0xC8C8DC),
- ENDERIUM("enderium", true, Materials.Enderium, 40,0x2E8B57, 0x599087),
+ REDALLOY(11, "redalloy", true, Materials.RedAlloy, 100, 0xE60000, 0xB80000),
+ REDSTONEALLOY(12, "redstonealloy", true, Materials.RedstoneAlloy, 90, 0xB80000, 0xA50808),
+ CONDUCTIVEIRON(13, "conductiveiron", true, Materials.ConductiveIron, 80, 0x817671, 0xCEADA3),
+ VIBRANTALLOY(14, "vibrantalloy", true, Materials.VibrantAlloy, 50, 0x86A12D, 0xC4F2AE),
+ ENERGETICALLOY(15, "energeticalloy", true, Materials.EnergeticAlloy, 70, 0xFF9933, 0xFFAD5C),
+ ELECTRICALSTEEL(16, "electricalsteel", true, Materials.ElectricalSteel, 90, 0x787878, 0xD8D8D8),
+ DARKSTEEL(17, "darksteel", true, Materials.DarkSteel, 80, 0x252525, 0x443B44),
+ PULSATINGIRON(18, "pulsatingiron", true, Materials.PulsatingIron, 80, 0x006600, 0x6DD284),
+ STAINLESSSTEEL(19, "stainlesssteel", true, Materials.StainlessSteel, 75, 0x778899, 0xC8C8DC),
+ ENDERIUM(20, "enderium", true, Materials.Enderium, 40, 0x2E8B57, 0x599087),
//Thaumcraft Line
- THAUMIUMDUST("thaumiumdust", true, Materials.Thaumium, 100,0x7A007A, 0x5C005C),
- THAUMIUMSHARD("thaumiumshard", true, Materials._NULL, 85,0x9966FF, 0xAD85FF),
- AMBER("amber", true, Materials.Amber, 90,0x774B15, 0xEE7700),
- QUICKSILVER("quicksilver", true, Materials.Mercury, 90,0xc7c7ea, 0xb5b3df),
- SALISMUNDUS("salismundus", true, Materials._NULL, 75,0xF7ADDE, 0x592582),
- TAINTED("tainted", true, Materials._NULL, 80,0x904BB8, 0xE800FF),
- MITHRIL("mithril", true, Materials.Mithril, 70,0xF0E68C, 0xFFFFD2),
- ASTRALSILVER("astralsilver", true, Materials.AstralSilver, 70,0xAFEEEE, 0xE6E6FF),
- THAUMINITE("thauminite", true, Materials._NULL, 50,0x2E2D79, 0x7581E0),
- SHADOWMETAL("shadowmetal", true, Materials.Shadow, 50,0x100322, 0x100342),
- DIVIDED("divided", true, Materials.Unstable, 40,0xF0F0F0, 0xDCDCDC),
- SPARKELING("sparkling", true, Materials.NetherStar, 40,0x7A007A, 0xFFFFFF),
+ THAUMIUMDUST(21, "thaumiumdust", true, Materials.Thaumium, 100, 0x7A007A, 0x5C005C),
+ THAUMIUMSHARD(22, "thaumiumshard", true, Materials._NULL, 85, 0x9966FF, 0xAD85FF),
+ AMBER(23, "amber", true, Materials.Amber, 90, 0x774B15, 0xEE7700),
+ QUICKSILVER(24, "quicksilver", true, Materials.Mercury, 90, 0xc7c7ea, 0xb5b3df),
+ SALISMUNDUS(25, "salismundus", true, Materials._NULL, 75, 0xF7ADDE, 0x592582),
+ TAINTED(26, "tainted", true, Materials._NULL, 80, 0x904BB8, 0xE800FF),
+ MITHRIL(27, "mithril", true, Materials.Mithril, 70, 0xF0E68C, 0xFFFFD2),
+ ASTRALSILVER(28, "astralsilver", true, Materials.AstralSilver, 70, 0xAFEEEE, 0xE6E6FF),
+ THAUMINITE(29, "thauminite", true, Materials._NULL, 50, 0x2E2D79, 0x7581E0),
+ SHADOWMETAL(30, "shadowmetal", true, Materials.Shadow, 50, 0x100322, 0x100342),
+ DIVIDED(31, "divided", true, Materials.Unstable, 40, 0xF0F0F0, 0xDCDCDC),
+ SPARKELING(32, "sparkling", true, Materials.NetherStar, 40, 0x7A007A, 0xFFFFFF),
//Gem Line
- STONE("stone", true, Materials._NULL, 70,0x808080, 0x999999),
- CERTUS("certus", true, Materials.CertusQuartz, 100,0x57CFFB, 0xBBEEFF),
- FLUIX("fluix", true, Materials.Fluix, 100,0xA375FF, 0xB591FF),
- REDSTONE("redstone", true, Materials.Redstone, 100,0x7D0F0F, 0xD11919),
- RAREEARTH("rareearth", true, Materials.RareEarth, 100,0x555643, 0x343428),
- LAPIS("lapis", true, Materials.Lapis, 100,0x1947D1, 0x476CDA),
- RUBY("ruby", true, Materials.Ruby, 100,0xE6005C, 0xCC0052),
- REDGARNET("redgarnet", true, Materials.GarnetRed,100,0xBD4C4C, 0xECCECE),
- YELLOWGARNET("yellowgarnet", true, Materials.GarnetYellow,100,0xA3A341, 0xEDEDCE),
- SAPPHIRE("sapphire", true, Materials.Sapphire, 100,0x0033CC, 0x00248F),
- DIAMOND("diamond", true, Materials.Diamond, 100,0xCCFFFF, 0xA3CCCC),
- OLIVINE("olivine", true, Materials.Olivine, 100,0x248F24, 0xCCFFCC),
- EMERALD("emerald", true, Materials.Emerald, 100,0x248F24, 0x2EB82E),
- PYROPE("pyrope", true, Materials.Pyrope, 100,0x763162, 0x8B8B8B),
- GROSSULAR("grossular", true, Materials.Grossular, 100,0x9B4E00, 0x8B8B8B),
- FIRESTONE("firestone", true, Materials.Firestone, 100,0xC00000, 0xFF0000),
+ STONE(33, "stone", true, Materials._NULL, 70, 0x808080, 0x999999),
+ CERTUS(34, "certus", true, Materials.CertusQuartz, 100, 0x57CFFB, 0xBBEEFF),
+ FLUIX(35, "fluix", true, Materials.Fluix, 100, 0xA375FF, 0xB591FF),
+ REDSTONE(36, "redstone", true, Materials.Redstone, 100, 0x7D0F0F, 0xD11919),
+ RAREEARTH(37, "rareearth", true, Materials.RareEarth, 100, 0x555643, 0x343428),
+ LAPIS(38, "lapis", true, Materials.Lapis, 100, 0x1947D1, 0x476CDA),
+ RUBY(39, "ruby", true, Materials.Ruby, 100, 0xE6005C, 0xCC0052),
+ REDGARNET(40, "redgarnet", true, Materials.GarnetRed, 100, 0xBD4C4C, 0xECCECE),
+ YELLOWGARNET(41, "yellowgarnet", true, Materials.GarnetYellow, 100, 0xA3A341, 0xEDEDCE),
+ SAPPHIRE(42, "sapphire", true, Materials.Sapphire, 100, 0x0033CC, 0x00248F),
+ DIAMOND(43, "diamond", true, Materials.Diamond, 100, 0xCCFFFF, 0xA3CCCC),
+ OLIVINE(44, "olivine", true, Materials.Olivine, 100, 0x248F24, 0xCCFFCC),
+ EMERALD(45, "emerald", true, Materials.Emerald, 100, 0x248F24, 0x2EB82E),
+ PYROPE(46, "pyrope", true, Materials.Pyrope, 100, 0x763162, 0x8B8B8B),
+ GROSSULAR(47, "grossular", true, Materials.Grossular, 100, 0x9B4E00, 0x8B8B8B),
+ FIRESTONE(48, "firestone", true, Materials.Firestone, 100, 0xC00000, 0xFF0000),
//Metals Line
- SLAG("slag", true, Materials._NULL, 50,0xD4D4D4, 0x58300B),
- COPPER("copper", true, Materials.Copper, 100,0xFF6600, 0xE65C00),
- TIN("tin", true, Materials.Tin, 100,0xD4D4D4, 0xDDDDDD),
- LEAD("lead", true, Materials.Lead, 100,0x666699, 0xA3A3CC),
- IRON("iron", true, Materials.Iron, 100,0xDA9147, 0xDE9C59),
- STEEL("steel", true, Materials.Steel, 95,0x808080, 0x999999),
- NICKEL("nickel", true, Materials.Nickel, 100,0x8585AD, 0x9D9DBD),
- ZINC("zinc", true, Materials.Zinc, 100,0xF0DEF0, 0xF2E1F2),
- SILVER("silver", true, Materials.Silver, 100,0xC2C2D6, 0xCECEDE),
- GOLD("gold", true, Materials.Gold, 100,0xE6B800, 0xCFA600),
- SULFUR("sulfur", true, Materials.Sulfur, 100,0x6F6F01, 0x8B8B8B),
- GALLIUM ("gallium", true, Materials.Gallium, 75,0x8B8B8B, 0xC5C5E4),
- ARSENIC ("arsenic", true, Materials.Arsenic, 75,0x736C52, 0x292412),
+ SLAG(49, "slag", true, Materials._NULL, 50, 0xD4D4D4, 0x58300B),
+ COPPER(50, "copper", true, Materials.Copper, 100, 0xFF6600, 0xE65C00),
+ TIN(51, "tin", true, Materials.Tin, 100, 0xD4D4D4, 0xDDDDDD),
+ LEAD(52, "lead", true, Materials.Lead, 100, 0x666699, 0xA3A3CC),
+ IRON(53, "iron", true, Materials.Iron, 100, 0xDA9147, 0xDE9C59),
+ STEEL(54, "steel", true, Materials.Steel, 95, 0x808080, 0x999999),
+ NICKEL(55, "nickel", true, Materials.Nickel, 100, 0x8585AD, 0x9D9DBD),
+ ZINC(56, "zinc", true, Materials.Zinc, 100, 0xF0DEF0, 0xF2E1F2),
+ SILVER(57, "silver", true, Materials.Silver, 100, 0xC2C2D6, 0xCECEDE),
+ GOLD(58, "gold", true, Materials.Gold, 100, 0xE6B800, 0xCFA600),
+ SULFUR(59, "sulfur", true, Materials.Sulfur, 100, 0x6F6F01, 0x8B8B8B),
+ GALLIUM(60, "gallium", true, Materials.Gallium, 75, 0x8B8B8B, 0xC5C5E4),
+ ARSENIC(61, "arsenic", true, Materials.Arsenic, 75, 0x736C52, 0x292412),
//Rare Metals Line
- BAUXITE("bauxite", true, Materials.Bauxite, 85,0x6B3600, 0x8B8B8B),
- ALUMINIUM("aluminium", true, Materials.Aluminium, 60,0x008AB8, 0xD6D6FF),
- MANGANESE("manganese", true, Materials.Manganese, 30,0xD5D5D5, 0xAAAAAA),
- MAGNESIUM("magnesium", true, Materials.Magnesium, 75,0xF1D9D9, 0x8B8B8B),
- TITANIUM("titanium", true, Materials.Ilmenite, 100,0xCC99FF, 0xDBB8FF),
- CHROME("chromium", true, Materials.Chrome, 50,0xEBA1EB, 0xF2C3F2),
- TUNGSTEN("tungsten", true, Materials.Tungstate, 100,0x62626D, 0x161620),
- PLATINUM("platinum", true, Materials.Platinum, 40,0xE6E6E6, 0xFFFFCC),
- IRIDIUM("iridium", true, Materials.Iridium, 20,0xDADADA, 0xD1D1E0),
- MOLYBDENUM("molybdenum", true, Materials.Molybdenum, 20,0xAEAED4, 0x8B8B8B),
- OSMIUM("osmium", true, Materials.Osmium, 15,0x2B2BDA, 0x8B8B8B),
- LITHIUM("lithium", true, Materials.Lithium, 75,0xF0328C, 0xE1DCFF),
- SALT("salt", true, Materials.Salt, 90,0xF0C8C8, 0xFAFAFA),
- ELECTROTINE("electrotine", true, Materials.Electrotine, 75,0x1E90FF, 0x3CB4C8),
- ALMANDINE("almandine", true, Materials.Almandine, 85,0xC60000, 0x8B8B8B),
+ BAUXITE(62, "bauxite", true, Materials.Bauxite, 85, 0x6B3600, 0x8B8B8B),
+ ALUMINIUM(63, "aluminium", true, Materials.Aluminium, 60, 0x008AB8, 0xD6D6FF),
+ MANGANESE(64, "manganese", true, Materials.Manganese, 30, 0xD5D5D5, 0xAAAAAA),
+ MAGNESIUM(65, "magnesium", true, Materials.Magnesium, 75, 0xF1D9D9, 0x8B8B8B),
+ TITANIUM(66, "titanium", true, Materials.Ilmenite, 100, 0xCC99FF, 0xDBB8FF),
+ CHROME(67, "chromium", true, Materials.Chrome, 50, 0xEBA1EB, 0xF2C3F2),
+ TUNGSTEN(68, "tungsten", true, Materials.Tungstate, 100, 0x62626D, 0x161620),
+ PLATINUM(69, "platinum", true, Materials.Platinum, 40, 0xE6E6E6, 0xFFFFCC),
+ IRIDIUM(70, "iridium", true, Materials.Iridium, 20, 0xDADADA, 0xD1D1E0),
+ MOLYBDENUM(71, "molybdenum", true, Materials.Molybdenum, 20, 0xAEAED4, 0x8B8B8B),
+ OSMIUM(72, "osmium", true, Materials.Osmium, 15, 0x2B2BDA, 0x8B8B8B),
+ LITHIUM(73, "lithium", true, Materials.Lithium, 75, 0xF0328C, 0xE1DCFF),
+ SALT(74, "salt", true, Materials.Salt, 90, 0xF0C8C8, 0xFAFAFA),
+ ELECTROTINE(75, "electrotine", true, Materials.Electrotine, 75, 0x1E90FF, 0x3CB4C8),
+ ALMANDINE(76, "almandine", true, Materials.Almandine, 85, 0xC60000, 0x8B8B8B),
//Radioactive Line
- URANIUM("uranium", true, Materials.Uranium, 50,0x19AF19, 0x169E16),
- PLUTONIUM("plutonium", true, Materials.Plutonium, 10,0x240000, 0x570000),
- NAQUADAH("naquadah", true, Materials.Naquadah, 10,0x000000, 0x004400),
- NAQUADRIA("naquadria", true, Materials.Naquadria, 5,0x000000, 0x002400),
- DOB("d-o-b", true, Materials._NULL, 50,0x007700, 0x002400),
- THORIUM("thorium", true, Materials.Thorium, 75,0x001E00, 0x005000),
- LUTETIUM("lutetium", true, Materials.Lutetium, 10,0xE6FFE6, 0xFFFFFF),
- AMERICIUM("americium", true, Materials.Americium, 5,0xE6E6FF, 0xC8C8C8),
- NEUTRONIUM("neutronium", true, Materials.Neutronium, 2,0xFFF0F0, 0xFAFAFA),
+ URANIUM(77, "uranium", true, Materials.Uranium, 50, 0x19AF19, 0x169E16),
+ PLUTONIUM(78, "plutonium", true, Materials.Plutonium, 10, 0x240000, 0x570000),
+ NAQUADAH(79, "naquadah", true, Materials.Naquadah, 10, 0x000000, 0x004400),
+ NAQUADRIA(80, "naquadria", true, Materials.Naquadria, 5, 0x000000, 0x002400),
+ DOB(81, "d-o-b", true, Materials._NULL, 50, 0x007700, 0x002400),
+ THORIUM(82, "thorium", true, Materials.Thorium, 75, 0x001E00, 0x005000),
+ LUTETIUM(83, "lutetium", true, Materials.Lutetium, 10, 0xE6FFE6, 0xFFFFFF),
+ AMERICIUM(84, "americium", true, Materials.Americium, 5, 0xE6E6FF, 0xC8C8C8),
+ NEUTRONIUM(85, "neutronium", true, Materials.Neutronium, 2, 0xFFF0F0, 0xFAFAFA),
//Twilight
- NAGA("naga", true, Materials._NULL, 100,0x0D5A0D, 0x28874B),
- LICH("lich", true, Materials._NULL, 90,0x5C605E, 0xC5C5C5),
- HYDRA("hydra", true, Materials._NULL, 80,0x872836, 0xB8132C),
- URGHAST("urghast", true, Materials._NULL, 70,0x7C0618, 0xA7041C),
- SNOWQUEEN("snowqueen", true, Materials._NULL, 60,0x9C0018, 0xD02001),
+ NAGA(86, "naga", true, Materials._NULL, 100, 0x0D5A0D, 0x28874B),
+ LICH(87, "lich", true, Materials._NULL, 90, 0x5C605E, 0xC5C5C5),
+ HYDRA(88, "hydra", true, Materials._NULL, 80, 0x872836, 0xB8132C),
+ URGHAST(89, "urghast", true, Materials._NULL, 70, 0x7C0618, 0xA7041C),
+ SNOWQUEEN(90, "snowqueen", true, Materials._NULL, 60, 0x9C0018, 0xD02001),
//Space
- SPACE("space", true, Materials._NULL, 100,0x003366, 0xC0C0C0),
- METEORICIRON("meteoriciron",true, Materials.MeteoricIron, 100,0x321928, 0x643250),
- DESH("desh",true, Materials.Desh, 90,0x282828, 0x323232),
- LEDOX("ledox",true, Materials.Ledox, 75,0x0000CD, 0x0074FF),
- CALLISTOICE("callistoice",true, Materials.CallistoIce, 75,0x0074FF, 0x1EB1FF),
- MYTRYL("mytryl",true, Materials.Mytryl, 65,0xDAA520, 0xF26404),
- QUANTIUM("quantium",true, Materials.Quantium, 50,0x00FF00, 0x00D10B),
- ORIHARUKON("oriharukon",true, Materials.Oriharukon, 50,0x228B22, 0x677D68),
- MYSTERIOUSCRYSTAL("mysteriouscrystal",true, Materials.MysteriousCrystal, 45,0x3CB371, 0x16856C),
- BLACKPLUTONIUM("blackplutonium",true, Materials.Quantium, 25,0x000000, 0x323232),
- TRINIUM("trinium",true, Materials.Trinium, 25,0xB0E0E6, 0xC8C8D2),
+ SPACE(91, "space", true, Materials._NULL, 100, 0x003366, 0xC0C0C0),
+ METEORICIRON(92, "meteoriciron", true, Materials.MeteoricIron, 100, 0x321928, 0x643250),
+ DESH(93, "desh", true, Materials.Desh, 90, 0x282828, 0x323232),
+ LEDOX(94, "ledox", true, Materials.Ledox, 75, 0x0000CD, 0x0074FF),
+ CALLISTOICE(95, "callistoice", true, Materials.CallistoIce, 75, 0x0074FF, 0x1EB1FF),
+ MYTRYL(96, "mytryl", true, Materials.Mytryl, 65, 0xDAA520, 0xF26404),
+ QUANTIUM(97, "quantium", true, Materials.Quantium, 50, 0x00FF00, 0x00D10B),
+ ORIHARUKON(98, "oriharukon", true, Materials.Oriharukon, 50, 0x228B22, 0x677D68),
+ MYSTERIOUSCRYSTAL(99, "mysteriouscrystal", true, Materials.MysteriousCrystal, 45, 0x3CB371, 0x16856C),
+ BLACKPLUTONIUM(100, "blackplutonium", true, Materials.Quantium, 25, 0x000000, 0x323232),
+ TRINIUM(101, "trinium", true, Materials.Trinium, 25, 0xB0E0E6, 0xC8C8D2),
//Planet
- MERCURY("mercury", true, Materials._NULL, 65,0x4A4033, 0xB5A288),
- VENUS("venus",true, Materials._NULL, 65,0x120E07, 0x272010),
- MOON("moon",true, Materials._NULL, 90,0x373735, 0x7E7E78),
- MARS("mars",true, Materials._NULL, 80,0x220D05, 0x3A1505),
- JUPITER("jupiter",true, Materials._NULL, 75,0x734B2E, 0xD0CBC4),
- SATURN("saturn",true, Materials._NULL, 55,0xD2A472, 0xF8C37B),
- URANUS("uranus",true, Materials._NULL, 45,0x75C0C9, 0x84D8EC),
- NEPTUN("neptun",true, Materials._NULL, 35,0x334CFF, 0x576DFF),
- PLUTO("pluto",true, Materials._NULL, 25,0x34271E, 0x69503D),
- HAUMEA("haumea",true, Materials._NULL, 20,0x1C1413, 0x392B28),
- MAKEMAKE("makemake",true, Materials._NULL, 20,0x301811, 0x120A07),
- CENTAURI("centauri",true, Materials._NULL, 15,0x2F2A14, 0xB06B32),
- TCETI("tceti",true, Materials._NULL, 10,0x46241A, 0x7B412F),
- BARNARDA("barnarda",true, Materials._NULL, 10,0x0D5A0D, 0xE6C18D),
- VEGA("vega",true, Materials._NULL, 10,0x1A2036, 0xB5C0DE),
+ MERCURY(102, "mercury", true, Materials._NULL, 65, 0x4A4033, 0xB5A288),
+ VENUS(103, "venus", true, Materials._NULL, 65, 0x120E07, 0x272010),
+ MOON(104, "moon", true, Materials._NULL, 90, 0x373735, 0x7E7E78),
+ MARS(105, "mars", true, Materials._NULL, 80, 0x220D05, 0x3A1505),
+ JUPITER(106, "jupiter", true, Materials._NULL, 75, 0x734B2E, 0xD0CBC4),
+ SATURN(107, "saturn", true, Materials._NULL, 55, 0xD2A472, 0xF8C37B),
+ URANUS(108, "uranus", true, Materials._NULL, 45, 0x75C0C9, 0x84D8EC),
+ NEPTUN(109, "neptun", true, Materials._NULL, 35, 0x334CFF, 0x576DFF),
+ PLUTO(110, "pluto", true, Materials._NULL, 25, 0x34271E, 0x69503D),
+ HAUMEA(111, "haumea", true, Materials._NULL, 20, 0x1C1413, 0x392B28),
+ MAKEMAKE(112, "makemake", true, Materials._NULL, 20, 0x301811, 0x120A07),
+ CENTAURI(113, "centauri", true, Materials._NULL, 15, 0x2F2A14, 0xB06B32),
+ TCETI(114, "tceti", true, Materials._NULL, 10, 0x46241A, 0x7B412F),
+ BARNARDA(115, "barnarda", true, Materials._NULL, 10, 0x0D5A0D, 0xE6C18D),
+ VEGA(116, "vega", true, Materials._NULL, 10, 0x1A2036, 0xB5C0DE),
//Infinity
- COSMICNEUTRONIUM("cosmicneutronium",true, Materials._NULL, 5,0x484848, 0x323232),
- INFINITYCATALYST("infinitycatalyst",true, Materials._NULL, 2,0xFFFFFF, 0xFFFFFF),
- INFINITY("infinity",true, Materials._NULL, 1,0xFFFFFF, 0xFFFFFF),
+ COSMICNEUTRONIUM(117, "cosmicneutronium", true, Materials._NULL, 5, 0x484848, 0x323232),
+ INFINITYCATALYST(118, "infinitycatalyst", true, Materials._NULL, 2, 0xFFFFFF, 0xFFFFFF),
+ INFINITY(119, "infinity", true, Materials._NULL, 1, 0xFFFFFF, 0xFFFFFF),
//HEE
- ENDDUST("enddust", true, Materials._NULL, 50,0x003A7D, 0xCC00FA),
- ECTOPLASMA("ectoplasma", true, Materials._NULL, 35,0x381C40, 0xDCB0E5),
- ARCANESHARD("arcaneshard", true, Materials._NULL, 35,0x333D82, 0x9010AD),
- STARDUST("stardust", true, Materials._NULL, 60,0xDCBE13, 0xffff00),
- DRAGONESSENCE("dragonessence", true, Materials._NULL, 30,0x911ECE, 0xFFA12B),
- ENDERMAN("enderman", true, Materials._NULL, 25,0x6200e7, 0x161616),
- SILVERFISH("silverfish", true, Materials._NULL, 25,0x0000000, 0xEE053D),
- ENDIUM("endium", true, Materials.HeeEndium, 50,0x2F5A6C, 0xa0ffff),
- RUNEI("rune1", true, Materials._NULL, 10,0x0104D9, 0xE31010),
- RUNEII("rune2", true, Materials._NULL, 10,0xE31010, 0x0104D9),
- FIREESSENSE("fireessence", true, Materials._NULL, 30,0xFFA157, 0xD41238),
-
- //New Combs to avoid meta id issues
- CRYOLITE("cryolite", true, Materials.Cryolite, 90, 0xBFEFFF, 0x73B9D0);
+ ENDDUST(120, "enddust", true, Materials._NULL, 50, 0x003A7D, 0xCC00FA),
+ ECTOPLASMA(121, "ectoplasma", true, Materials._NULL, 35, 0x381C40, 0xDCB0E5),
+ ARCANESHARD(122, "arcaneshard", true, Materials._NULL, 35, 0x333D82, 0x9010AD),
+ STARDUST(123, "stardust", true, Materials._NULL, 60, 0xDCBE13, 0xffff00),
+ DRAGONESSENCE(124, "dragonessence", true, Materials._NULL, 30, 0x911ECE, 0xFFA12B),
+ ENDERMAN(125, "enderman", true, Materials._NULL, 25, 0x6200e7, 0x161616),
+ SILVERFISH(126, "silverfish", true, Materials._NULL, 25, 0x0000000, 0xEE053D),
+ ENDIUM(127, "endium", true, Materials.HeeEndium, 50, 0x2F5A6C, 0xa0ffff),
+ RUNEI(128, "rune1", true, Materials._NULL, 10, 0x0104D9, 0xE31010),
+ RUNEII(129, "rune2", true, Materials._NULL, 10, 0xE31010, 0x0104D9),
+ FIREESSENSE(130, "fireessence", true, Materials._NULL, 30, 0xFFA157, 0xD41238),
+ CRYOLITE(131, "cryolite", true, Materials.Cryolite, 90, 0xBFEFFF, 0x73B9D0),
+ _NULL(-1, "INVALIDCOMB", false, Materials._NULL, 0, 0, 0);
public boolean showInList;
public Materials material;
public int chance;
- private String name;
- private int[] color;
+ private final int id;
+ private final String name;
+ private final int[] color;
CombType(String pName, boolean show, Materials material, int chance, int... color) {
+ this.id = ordinal();
+ this.name = pName;
+ this.material = material;
+ this.chance = chance;
+ this.showInList = show;
+ this.color = color;
+ }
+
+ CombType(int id, String pName, boolean show, Materials material, int chance, int... color) {
+ if (id < 0 && !"INVALIDCOMB".equals(pName))
+ throw new IllegalArgumentException();
+ this.id = id;
this.name = pName;
this.material = material;
this.chance = chance;
this.showInList = show;
- this.color=color;
+ this.color = color;
}
public void setHidden() {
@@ -189,6 +203,28 @@ public enum CombType {
}
public int[] getColours() {
- return color == null || color.length != 2 ? new int[]{0,0} : color;
+ return color == null || color.length != 2 ? new int[]{0, 0} : color;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public static CombType valueOf(int id) {
+ return id < 0 || id >= Companion.VALUES.length ? _NULL : Companion.VALUES[id];
+ }
+
+ private static final class Companion {
+ private static final CombType[] VALUES;
+
+ static {
+ int biggestId = Arrays.stream(CombType.values()).mapToInt(CombType::getId).max().getAsInt();
+ VALUES = new CombType[biggestId + 1];
+ Arrays.fill(VALUES, _NULL);
+ for (CombType type : CombType.values()) {
+ if (type != _NULL)
+ VALUES[type.getId()] = type;
+ }
+ }
}
}
diff --git a/src/main/java/gregtech/common/items/ItemComb.java b/src/main/java/gregtech/common/items/ItemComb.java
index fe63f9085b..4599382063 100644
--- a/src/main/java/gregtech/common/items/ItemComb.java
+++ b/src/main/java/gregtech/common/items/ItemComb.java
@@ -43,11 +43,11 @@ public class ItemComb extends Item {
}
public ItemStack getStackForType(CombType type) {
- return new ItemStack(this, 1, type.ordinal());
+ return new ItemStack(this, 1, type.getId());
}
public ItemStack getStackForType(CombType type, int count) {
- return new ItemStack(this, count, type.ordinal());
+ return new ItemStack(this, count, type.getId());
}
@Override
@@ -86,19 +86,13 @@ public class ItemComb extends Item {
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
- int meta = Math.max(0, Math.min(CombType.values().length - 1, stack.getItemDamage()));
- int colour = CombType.values()[meta].getColours()[0];
-
- if (pass >= 1) {
- colour = CombType.values()[meta].getColours()[1];
- }
-
- return colour;
+ CombType type = CombType.valueOf(stack.getItemDamage());
+ return type.getColours()[GT_Utility.clamp(pass, 0, 1)];
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
- return CombType.values()[stack.getItemDamage()].getName();
+ return CombType.valueOf(stack.getItemDamage()).getName();
}
public void initCombsRecipes() {
@@ -119,7 +113,7 @@ public class ItemComb extends Item {
addCentrifugeToItemStack(CombType.OIL, new ItemStack[] { ItemList.Crop_Drop_OilBerry.get(1), GT_Bees.drop.getStackForType(DropType.OIL), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Oilsands, 1), ItemList.FR_Wax.get(1) }, new int[] {70 * 100, 100 * 100, 100 * 100, 50 * 100}, Voltage.ULV);
addCentrifugeToMaterial(CombType.APATITE, new Materials[] { Materials.Apatite, Materials.Phosphate }, new int[] {100 * 100, 80 * 100 }, new int[] {}, Voltage.ULV, NI, 30 * 100);
}
-
+
//ic2
addCentrifugeToItemStack(CombType.COOLANT, new ItemStack[] { GT_Bees.drop.getStackForType(DropType.COOLANT), ItemList.FR_Wax.get(1) }, new int[] {100 * 100, 100 * 100}, Voltage.HV, 196);
addCentrifugeToItemStack(CombType.ENERGY, new ItemStack[] {GT_Bees.drop.getStackForType(DropType.HOT_COOLANT), ItemList.IC2_Energium_Dust.get(1L), ItemList.FR_RefractoryWax.get(1)}, new int[] {20 * 100, 20 * 100, 50 * 100}, Voltage.HV, 196);
@@ -159,7 +153,7 @@ public class ItemComb extends Item {
addCentrifugeToMaterial(CombType.PULSATINGIRON, new Materials[] {Materials.PulsatingIron, Materials.Iron }, new int[] {80 * 100, 75 * 100 }, new int[] {}, Voltage.HV, ItemList.FR_RefractoryWax.get(1), 50 * 100);
addCentrifugeToMaterial(CombType.STAINLESSSTEEL, new Materials[] {Materials.StainlessSteel, Materials.Iron, Materials.Chrome, Materials.Manganese, Materials.Nickel }, new int[] {50 * 100, 75 * 100, 55 * 100, 75 * 100, 75 * 100 }, new int[] {}, Voltage.HV, ItemList.FR_RefractoryWax.get(1), 50 * 100);
}
-
+
//Thaumic
addProcessGT(CombType.THAUMIUMDUST, new Materials[] {Materials.Thaumium, Materials.Iron }, Voltage.MV);
addCentrifugeToItemStack(CombType.THAUMIUMSHARD, new ItemStack[] {GT_ModHandler.getModItem("MagicBees", "propolis", 1, 1), GT_ModHandler.getModItem("MagicBees", "propolis", 1, 2), GT_ModHandler.getModItem("MagicBees", "propolis", 1, 3), GT_ModHandler.getModItem("MagicBees", "propolis", 1, 4), GT_ModHandler.getModItem("MagicBees", "propolis", 1, 5), GT_ModHandler.getModItem("MagicBees", "propolis", 1, 6), GT_ModHandler.getModItem("MagicBees", "wax", 1, 0) }, new int[] {20 * 100, 20 * 100, 20 * 100, 20 * 100, 20 * 100, 20 * 100, 50 * 100 }, Voltage.ULV);
@@ -186,7 +180,7 @@ public class ItemComb extends Item {
addCentrifugeToItemStack(CombType.QUICKSILVER, new ItemStack[] {GT_ModHandler.getModItem("MagicBees", "wax", 1, 0), GT_ModHandler.getModItem("Thaumcraft", "ItemNugget", 1, 5), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Cinnabar, 1) }, new int[] {50 * 100, 100 * 100, 85 * 100 }, Voltage.ULV);
addCentrifugeToMaterial(CombType.MITHRIL, new Materials[] {Materials.Mithril, Materials.Platinum}, new int[] {75 * 100, 55 * 100}, new int[] {}, Voltage.HV, GT_ModHandler.getModItem("MagicBees", "wax", 1, 0), 50 * 100);
}
-
+
//Gem Line
addProcessGT(CombType.STONE, new Materials[] {Materials.Soapstone, Materials.Talc, Materials.Apatite, Materials.Phosphate, Materials.TricalciumPhosphate}, Voltage.LV);
addProcessGT(CombType.CERTUS, new Materials[] {Materials.CertusQuartz, Materials.Quartzite, Materials.Barite}, Voltage.LV);
@@ -224,7 +218,7 @@ public class ItemComb extends Item {
addCentrifugeToMaterial(CombType.PYROPE, new Materials[] {Materials.Pyrope, Materials.Aluminium, Materials.Magnesium, Materials.Silicon}, new int[] {100 * 100, 75 * 100, 80 * 100, 75 * 100}, new int[] {}, Voltage.ULV, NI, 30 * 100);
addCentrifugeToMaterial(CombType.GROSSULAR, new Materials[] {Materials.Grossular, Materials.Aluminium, Materials.Silicon}, new int[] {100 * 100, 75 * 100, 75 * 100}, new int[] {}, Voltage.ULV, NI, 30 * 100);
}
-
+
// Metals Line
addProcessGT(CombType.SLAG, new Materials[] {Materials.Salt, Materials.RockSalt, Materials.Lepidolite, Materials.Spodumene, Materials.Monazite}, Voltage.LV);
addProcessGT(CombType.COPPER, new Materials[] {Materials.Copper, Materials.Tetrahedrite, Materials.Chalcopyrite, Materials.Malachite, Materials.Pyrite, Materials.Stibnite}, Voltage.LV);
@@ -314,7 +308,7 @@ public class ItemComb extends Item {
addCentrifugeToItemStack(CombType.SALT, new ItemStack[] { GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Salt, 1), GT_ModHandler.getModItem(MOD_ID_DC, "item.EdibleSalt", 1L, 0),GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.RockSalt, 1), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Saltpeter, 1), ItemList.FR_Wax.get(1) }, new int[] {100 * 100, 50 * 100, 75 * 100, 65 * 100, 50 * 100}, Voltage.MV, 160);
addCentrifugeToMaterial(CombType.ELECTROTINE, new Materials[] {Materials.Electrotine, Materials.Electrum, Materials.Redstone}, new int[] { 80, 75, 65}, new int[] {}, Voltage.MV, NI, 30 * 100);
}
-
+
//Radioactive Line
addProcessGT(CombType.ALMANDINE, new Materials[] {Materials.Almandine, Materials.Pyrope, Materials.Sapphire, Materials.GreenSapphire}, Voltage.LV);
addProcessGT(CombType.URANIUM, new Materials[] {Materials.Uranium, Materials.Pitchblende, Materials.Uraninite, Materials.Uranium235}, Voltage.EV);
@@ -337,7 +331,7 @@ public class ItemComb extends Item {
addCentrifugeToMaterial(CombType.AMERICIUM,new Materials[] {Materials.Americium, Materials.Lutetium}, new int[] {25 * 100, 45 * 100}, new int[] {}, Voltage.LUV, NI, 30 * 100);
addCentrifugeToMaterial(CombType.NEUTRONIUM,new Materials[] {Materials.Neutronium, Materials.Americium}, new int[] {15 * 100, 35 * 100}, new int[] {}, Voltage.UV, NI, 30 * 100);
}
-
+
// Twilight
addCentrifugeToItemStack(CombType.NAGA, new ItemStack[] { GT_ModHandler.getModItem("MagicBees", "propolis", 1L, 4), GT_ModHandler.getModItem(MOD_ID_DC, "item.NagaScaleChip", 1L, 0), GT_ModHandler.getModItem(MOD_ID_DC, "item.NagaScaleFragment", 1L, 0), ItemList.FR_Wax.get(1)}, new int[]{5 * 100, 33 * 100, 8 * 100, 30 * 100}, Voltage.MV);
addCentrifugeToItemStack(CombType.LICH, new ItemStack[] { GT_ModHandler.getModItem("MagicBees", "propolis", 1L, 5), GT_ModHandler.getModItem(MOD_ID_DC, "item.LichBoneChip", 1L, 0), GT_ModHandler.getModItem(MOD_ID_DC, "item.LichBoneFragment", 1L, 0), ItemList.FR_Wax.get(1)}, new int[]{5 * 100, 33 * 100, 8 * 100, 30 * 100}, Voltage.HV);
@@ -408,7 +402,7 @@ public class ItemComb extends Item {
addCentrifugeToMaterial(CombType.INFINITYCATALYST, new Materials[] {Materials.InfinityCatalyst, Materials.Neutronium}, new int[] {(int) (0.05 * 100), 1 * 100}, new int[] {}, Voltage.UEV, 48000, NI, 50 * 100);
addCentrifugeToMaterial(CombType.INFINITY, new Materials[] {Materials.Infinity, Materials.InfinityCatalyst}, new int[] {(int) (0.01 * 100), (int) (0.05 * 100)}, new int[] {}, Voltage.UIV, 96000, NI, 50 * 100);
}
-
+
/**
* Currently use for STEEL, GOLD, MOLYBDENUM, PLUTONIUM
* **/
@@ -416,7 +410,7 @@ public class ItemComb extends Item {
if(GT_OreDictUnificator.get(OrePrefixes.crushedPurified, aOutMaterial, 4) == NI) return;
RA.addChemicalRecipe(GT_Utility.copyAmount(9, getStackForType(comb)), GT_OreDictUnificator.get(OrePrefixes.crushed, aInMaterial, 1), volt.getComplexChemical(), aInMaterial.mOreByProducts.isEmpty() ? null : aInMaterial.mOreByProducts.get(0).getMolten(144), GT_OreDictUnificator.get(OrePrefixes.crushedPurified, aOutMaterial, 4), NI, volt.getComplexTime(), volt.getChemicalEnergy(), volt.compareTo(Voltage.IV) > 0);
}
-
+
/**
* Currently only used for CombType.MOLYBDENUM
* @param circuitNumber should not conflict with addProcessGT
@@ -426,7 +420,7 @@ public class ItemComb extends Item {
if(GT_OreDictUnificator.get(OrePrefixes.crushedPurified, aMaterial, 4) == NI) return;
RA.addAutoclaveRecipe(GT_Utility.copyAmount(9, getStackForType(comb)), GT_Utility.getIntegratedCircuit(circuitNumber), Materials.UUMatter.getFluid(Math.max(1, ((aMaterial.getMass()+volt.getUUAmplifier())/10))), GT_OreDictUnificator.get(OrePrefixes.crushedPurified, aMaterial, 4), 10000, (int) (aMaterial.getMass() * 128), volt.getAutoClaveEnergy(), volt.compareTo(Voltage.HV) > 0);
}
-
+
/**
* this only adds Chemical and AutoClave process.
* If you need Centrifuge recipe. use addCentrifugeToMaterial or addCentrifugeToItemStack
@@ -442,7 +436,7 @@ public class ItemComb extends Item {
}
}
}
-
+
/**
* this method only adds Centrifuge based on Material. If volt is lower than MV than it will also adds forestry centrifuge recipe.
* @param comb BeeComb
@@ -481,7 +475,7 @@ public class ItemComb extends Item {
addCentrifugeToItemStack(comb, aOutPut, chance, volt, duration);
}
-
+
/**
* @param volt required Tier of system. If it's lower than MV, it will also add forestry centrifuge.
* @param aItem can be more than 6. but Over 6 will be ignored in Gregtech Centrifuge.
@@ -500,7 +494,7 @@ public class ItemComb extends Item {
if(volt.compareTo(Voltage.MV) < 0 || !GT_Mod.gregtechproxy.mNerfedCombs) {
RecipeManagers.centrifugeManager.addRecipe(40, tComb, Product.build());
}
-
+
aItem = Arrays.copyOf(aItem, 6);
if(aItem.length > 6) {
chance = Arrays.copyOf(chance, 6);
@@ -508,7 +502,7 @@ public class ItemComb extends Item {
RA.addCentrifugeRecipe(tComb, NI, NF, NF, aItem[0], aItem[1], aItem[2], aItem[3], aItem[4], aItem[5], chance, duration, volt.getSimpleEnergy());
}
-
+
enum Voltage {
ULV, LV, MV,
HV, EV, IV,
diff --git a/src/test/java/gregtech/common/items/CombTypeTest.java b/src/test/java/gregtech/common/items/CombTypeTest.java
new file mode 100644
index 0000000000..0f55d0afd1
--- /dev/null
+++ b/src/test/java/gregtech/common/items/CombTypeTest.java
@@ -0,0 +1,43 @@
+package gregtech.common.items;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class CombTypeTest {
+ @Test
+ void noDuplicateID() {
+ Set<Integer> seen = new HashSet<>();
+ for (CombType value : CombType.values()) {
+ assertTrue(seen.add(value.getId()), "Comb type must not have duplicate ID");
+ }
+ }
+
+ @Test
+ void noNegativeID() {
+ for (CombType value : CombType.values()) {
+ if (value == CombType._NULL)
+ assertTrue(value.getId() <= 0, "Comb type ID must be negative for _NULL");
+ else
+ assertTrue(value.getId() >= 0, "Comb type ID must not be negative");
+ }
+ }
+
+ @Test
+ void invalidIDNotNull() {
+ assertEquals(CombType.valueOf(-2), CombType._NULL, "Invalid ID Lookup should result in _NULL");
+ assertEquals(CombType.valueOf(Integer.MAX_VALUE), CombType._NULL, "Invalid ID Lookup should result in _NULL");
+ }
+
+ @Test
+ void validIDCorrectComb() {
+ for (CombType value : CombType.values()) {
+ if (value != CombType._NULL)
+ assertEquals(CombType.valueOf(value.getId()), value, "Valid ID Lookup should result in correct output");
+ }
+ }
+}