aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r--src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java3
-rw-r--r--src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java6
-rw-r--r--src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java3
-rw-r--r--src/main/java/gregtech/api/util/GT_Assemblyline_Server.java5
-rw-r--r--src/main/java/gregtech/api/util/GT_BaseCrop.java12
-rw-r--r--src/main/java/gregtech/api/util/GT_CLS_Compat.java4
-rw-r--r--src/main/java/gregtech/api/util/GT_CircuitryBehavior.java11
-rw-r--r--src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java8
-rw-r--r--src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java2
-rw-r--r--src/main/java/gregtech/api/util/GT_HatchElementBuilder.java22
-rw-r--r--src/main/java/gregtech/api/util/GT_LanguageManager.java1
-rw-r--r--src/main/java/gregtech/api/util/GT_ModHandler.java37
-rw-r--r--src/main/java/gregtech/api/util/GT_OreDictUnificator.java9
-rw-r--r--src/main/java/gregtech/api/util/GT_OverclockCalculator.java46
-rw-r--r--src/main/java/gregtech/api/util/GT_Recipe.java94
-rw-r--r--src/main/java/gregtech/api/util/GT_RecipeBuilder.java3
-rw-r--r--src/main/java/gregtech/api/util/GT_RecipeMapUtil.java17
-rw-r--r--src/main/java/gregtech/api/util/GT_RecipeRegistrator.java54
-rw-r--r--src/main/java/gregtech/api/util/GT_Single_Recipe_Check.java1
-rw-r--r--src/main/java/gregtech/api/util/GT_StructureUtility.java13
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java98
-rw-r--r--src/main/java/gregtech/api/util/GT_UtilityClient.java1
-rw-r--r--src/main/java/gregtech/api/util/ISerializableObject.java2
23 files changed, 260 insertions, 192 deletions
diff --git a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java
index f898049e46..389662d041 100644
--- a/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java
+++ b/src/main/java/gregtech/api/util/ColorsMetadataSectionSerializer.java
@@ -68,8 +68,7 @@ public class ColorsMetadataSectionSerializer extends BaseMetadataSectionSerializ
}
public JsonElement serialize(ColorsMetadataSection colorsMetaSection, Type type, JsonSerializationContext context) {
- JsonObject jsonObject = new JsonObject();
- return jsonObject;
+ return new JsonObject();
}
public String getSectionName() {
diff --git a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java
index de46309a9f..a31038dd60 100644
--- a/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java
+++ b/src/main/java/gregtech/api/util/GT_ApiaryUpgrade.java
@@ -1,6 +1,10 @@
package gregtech.api.util;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
diff --git a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java
index 077964cb69..1eba5c843c 100644
--- a/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java
+++ b/src/main/java/gregtech/api/util/GT_AssemblyLineUtils.java
@@ -320,8 +320,7 @@ public class GT_AssemblyLineUtils {
*/
public static ItemStack getDataStickOutput(ItemStack aDataStick) {
if (doesDataStickHaveOutput(aDataStick)) {
- ItemStack aOutput = GT_Utility.loadItem(aDataStick.getTagCompound(), "output");
- return aOutput;
+ return GT_Utility.loadItem(aDataStick.getTagCompound(), "output");
}
return null;
}
diff --git a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java
index e5889a6442..1881ab015a 100644
--- a/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java
+++ b/src/main/java/gregtech/api/util/GT_Assemblyline_Server.java
@@ -23,9 +23,8 @@ public class GT_Assemblyline_Server {
public static void fillMap(FMLPreInitializationEvent aEvent) {
- String s = new String(
- aEvent.getModConfigurationDirectory()
- .getAbsolutePath());
+ String s = aEvent.getModConfigurationDirectory()
+ .getAbsolutePath();
s = s.substring(
0,
aEvent.getModConfigurationDirectory()
diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java
index 456ba50ff1..90c1619472 100644
--- a/src/main/java/gregtech/api/util/GT_BaseCrop.java
+++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java
@@ -253,18 +253,6 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo {
return true;
}
}
- // Block block = aCrop.getWorld().getBlock(aCrop.getLocation().posX, aCrop.getLocation().posY - i,
- // aCrop.getLocation().posZ);
- // if (block.isAir(aCrop.getWorld(), aCrop.getLocation().posX, aCrop.getLocation().posY - i,
- // aCrop.getLocation().posZ)) {
- // return false;
- // }
- // if (block == mBlock) {
- // int tMeta = aCrop.getWorld().getBlockMetadata(aCrop.getLocation().posX, aCrop.getLocation().posY -
- // i, aCrop.getLocation().posZ);
- // if(mMeta < 0 || tMeta == mMeta){
- // return true;}
- // }
}
return false;
}
diff --git a/src/main/java/gregtech/api/util/GT_CLS_Compat.java b/src/main/java/gregtech/api/util/GT_CLS_Compat.java
index 0d3864e26f..c560435e30 100644
--- a/src/main/java/gregtech/api/util/GT_CLS_Compat.java
+++ b/src/main/java/gregtech/api/util/GT_CLS_Compat.java
@@ -119,7 +119,7 @@ public class GT_CLS_Compat {
}
public static void stepMaterialsCLS(Collection<GT_Proxy.OreDictEventContainer> mEvents,
- ProgressManager.ProgressBar progressBar) throws IllegalAccessException, InvocationTargetException {
+ ProgressManager.ProgressBar progressBar) throws IllegalAccessException {
try {
isRegisteringGTmaterials.set(null, true);
} catch (IllegalArgumentException | IllegalAccessException e) {
@@ -136,7 +136,7 @@ public class GT_CLS_Compat {
}
public static void doActualRegistrationCLS(ProgressManager.ProgressBar progressBar,
- Set<Materials> replacedVanillaItemsSet) throws InvocationTargetException, IllegalAccessException {
+ Set<Materials> replacedVanillaItemsSet) {
try {
isReplacingVanillaMaterials.set(null, true);
} catch (IllegalArgumentException | IllegalAccessException e) {
diff --git a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java
index d5cd50049e..63fb7d1e70 100644
--- a/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java
+++ b/src/main/java/gregtech/api/util/GT_CircuitryBehavior.java
@@ -107,9 +107,7 @@ public abstract class GT_CircuitryBehavior {
return tRedstoneAmount;
}
- /*****************
- * GUI Functions *
- *****************/
+ // region GUI Functions
/**
* returns the weakest incoming non-zero RS-Power
@@ -167,9 +165,9 @@ public abstract class GT_CircuitryBehavior {
*/
public abstract void validateParameters(int[] aCircuitData, IRedstoneCircuitBlock aRedstoneCircuitBlock);
- /****************************
- * Useful Utility Functions *
- ****************************/
+ // endregion
+
+ // region Utility Functions
/**
* Called every tick if the Block has enough Energy and if the Block is Active
@@ -210,4 +208,5 @@ public abstract class GT_CircuitryBehavior {
public String getDataDisplay(int[] aCircuitData, int aCircuitDataIndex) {
return null;
}
+ // endregion
}
diff --git a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
index e1a49b998f..fdb4cbe7a4 100644
--- a/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
+++ b/src/main/java/gregtech/api/util/GT_CoverBehaviorBase.java
@@ -137,7 +137,7 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
/**
* Return whether cover data needs to be synced to client upon tile entity creation or cover placement.
- *
+ * <p>
* Note if you want to sync the data afterwards you will have to manually do it by calling
* {@link ICoverable#issueCoverUpdate(ForgeDirection)} This option only affects the initial sync.
*/
@@ -508,9 +508,9 @@ public abstract class GT_CoverBehaviorBase<T extends ISerializableObject> {
return colorOverride.getTextColorOrDefault(textType, defaultColor);
}
- protected Supplier<Integer> COLOR_TITLE = () -> getTextColorOrDefault("title", 0x222222);
- protected Supplier<Integer> COLOR_TEXT_GRAY = () -> getTextColorOrDefault("text_gray", 0x555555);
- protected Supplier<Integer> COLOR_TEXT_WARN = () -> getTextColorOrDefault("text_warn", 0xff0000);
+ protected final Supplier<Integer> COLOR_TITLE = () -> getTextColorOrDefault("title", 0x222222);
+ protected final Supplier<Integer> COLOR_TEXT_GRAY = () -> getTextColorOrDefault("text_gray", 0x555555);
+ protected final Supplier<Integer> COLOR_TEXT_WARN = () -> getTextColorOrDefault("text_warn", 0xff0000);
}
// endregion
diff --git a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java
index dbb14222c0..8e5301bd0b 100644
--- a/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java
+++ b/src/main/java/gregtech/api/util/GT_ExoticEnergyInputHelper.java
@@ -79,7 +79,7 @@ public class GT_ExoticEnergyInputHelper {
public static long getAverageInputVoltageMulti(Collection<? extends GT_MetaTileEntity_Hatch> hatches) {
long rVoltage = 0;
- if (hatches.size() <= 0) {
+ if (hatches.size() == 0) {
return rVoltage;
}
for (GT_MetaTileEntity_Hatch tHatch : hatches)
diff --git a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java
index 194a29f8a2..2087ad755c 100644
--- a/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java
+++ b/src/main/java/gregtech/api/util/GT_HatchElementBuilder.java
@@ -2,8 +2,19 @@ package gregtech.api.util;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import java.util.*;
-import java.util.function.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.function.BiPredicate;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
import java.util.stream.Collectors;
import net.minecraft.block.Block;
@@ -16,7 +27,12 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.gtnewhorizon.structurelib.StructureLibAPI;
-import com.gtnewhorizon.structurelib.structure.*;
+import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment;
+import com.gtnewhorizon.structurelib.structure.IItemSource;
+import com.gtnewhorizon.structurelib.structure.IStructureElement;
+import com.gtnewhorizon.structurelib.structure.IStructureElementChain;
+import com.gtnewhorizon.structurelib.structure.IStructureElementNoPlacement;
+import com.gtnewhorizon.structurelib.structure.StructureUtility;
import com.gtnewhorizon.structurelib.util.ItemStackPredicate;
import gnu.trove.TIntCollection;
diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java
index eeaa12a9ed..5bc2d0e9b1 100644
--- a/src/main/java/gregtech/api/util/GT_LanguageManager.java
+++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java
@@ -26,6 +26,7 @@ public class GT_LanguageManager {
public static boolean sUseEnglishFile = false;
public static boolean i18nPlaceholder = true;
+ // TODO: convert to enum
public static String FACE_ANY = "gt.lang.face.any", FACE_BOTTOM = "gt.lang.face.bottom",
FACE_TOP = "gt.lang.face.top", FACE_LEFT = "gt.lang.face.left", FACE_FRONT = "gt.lang.face.front",
FACE_RIGHT = "gt.lang.face.right", FACE_BACK = "gt.lang.face.back", FACE_NONE = "gt.lang.face.none";
diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java
index 21675a58a4..f0add071fd 100644
--- a/src/main/java/gregtech/api/util/GT_ModHandler.java
+++ b/src/main/java/gregtech/api/util/GT_ModHandler.java
@@ -91,7 +91,6 @@ public class GT_ModHandler {
private static final List<ItemStack> delayedRemovalByOutput = new ArrayList<>();
private static final List<InventoryCrafting> delayedRemovalByRecipe = new ArrayList<>();
- public static volatile int VERSION = 509;
public static Collection<String> sNativeRecipeClasses = new HashSet<>(), sSpecialRecipeClasses = new HashSet<>();
public static GT_HashSet<GT_ItemStack> sNonReplaceableItems = new GT_HashSet<>();
public static Object sBoxableWrapper = new GT_IBoxableWrapper();
@@ -862,11 +861,11 @@ public class GT_ModHandler {
*/
@Deprecated
public static boolean addThermalCentrifugeRecipe(ItemStack aInput, int[] aChances, int aHeat, Object... aOutput) {
- if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false;
+ if (aInput == null || aOutput == null || aOutput.length == 0 || aOutput[0] == null) return false;
if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.thermalcentrifuge, aInput, true)) return false;
RA.addThermalCentrifugeRecipe(
aInput,
- aOutput.length >= 1 ? (ItemStack) aOutput[0] : null,
+ (ItemStack) aOutput[0],
aOutput.length >= 2 ? (ItemStack) aOutput[1] : null,
aOutput.length >= 3 ? (ItemStack) aOutput[2] : null,
aChances,
@@ -877,11 +876,11 @@ public class GT_ModHandler {
@Deprecated
public static boolean addThermalCentrifugeRecipe(ItemStack aInput, int aHeat, Object... aOutput) {
- if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false;
+ if (aInput == null || aOutput == null || aOutput.length == 0 || aOutput[0] == null) return false;
if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.thermalcentrifuge, aInput, true)) return false;
RA.addThermalCentrifugeRecipe(
aInput,
- aOutput.length >= 1 ? (ItemStack) aOutput[0] : null,
+ (ItemStack) aOutput[0],
aOutput.length >= 2 ? (ItemStack) aOutput[1] : null,
aOutput.length >= 3 ? (ItemStack) aOutput[2] : null,
500,
@@ -893,7 +892,7 @@ public class GT_ModHandler {
* IC2-OreWasher Recipe. Overloads old Recipes automatically
*/
public static boolean addOreWasherRecipe(ItemStack aInput, int[] aChances, int aWaterAmount, Object... aOutput) {
- if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false;
+ if (aInput == null || aOutput == null || aOutput.length == 0 || aOutput[0] == null) return false;
if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false;
RA.addOreWasherRecipe(
aInput,
@@ -917,7 +916,7 @@ public class GT_ModHandler {
}
public static boolean addOreWasherRecipe(ItemStack aInput, int aWaterAmount, Object... aOutput) {
- if (aInput == null || aOutput == null || aOutput.length <= 0 || aOutput[0] == null) return false;
+ if (aInput == null || aOutput == null || aOutput.length == 0 || aOutput[0] == null) return false;
if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false;
RA.addOreWasherRecipe(
aInput,
@@ -1097,11 +1096,14 @@ public class GT_ModHandler {
boolean aRemoveAllOthersWithSameOutputIfTheyHaveSameNBT, boolean aRemoveAllOtherShapedsWithSameOutput,
boolean aRemoveAllOtherNativeRecipes, boolean aCheckForCollisions,
boolean aOnlyAddIfThereIsAnyRecipeOutputtingThis, boolean aOnlyAddIfResultIsNotNull, Object[] aRecipe) {
+
aResult = GT_OreDictUnificator.get(true, aResult);
if (aOnlyAddIfResultIsNotNull && aResult == null) return false;
if (aResult != null && Items.feather.getDamage(aResult) == W) Items.feather.setDamage(aResult, 0);
- if (aRecipe == null || aRecipe.length <= 0) return false;
+ if (aRecipe == null || aRecipe.length == 0) return false;
+ // The renamed variable clarifies what's happening
+ // noinspection UnnecessaryLocalVariable
boolean tDoWeCareIfThereWasARecipe = aOnlyAddIfThereIsAnyRecipeOutputtingThis;
boolean tThereWasARecipe = false;
@@ -1270,8 +1272,7 @@ public class GT_ModHandler {
if (tRecipe[x] != null && Items.feather.getDamage(tRecipe[x]) == W)
Items.feather.setDamage(tRecipe[x], 0);
}
- if (tDoWeCareIfThereWasARecipe || !aBuffered)
- tThereWasARecipe = removeRecipe(tRecipe) != null || tThereWasARecipe;
+ if (tDoWeCareIfThereWasARecipe || !aBuffered) tThereWasARecipe = removeRecipe(tRecipe) != null;
else removeRecipeDelayed(tRecipe);
}
} catch (Throwable e) {
@@ -1385,7 +1386,7 @@ public class GT_ModHandler {
int[] aEnchantmentLevelsAdded, boolean aBuffered, boolean aKeepNBT, boolean aDismantleable, boolean aRemovable,
Object[] aRecipe) {
aResult = GT_OreDictUnificator.get(true, aResult);
- if (aRecipe == null || aRecipe.length <= 0) return false;
+ if (aRecipe == null || aRecipe.length == 0) return false;
for (byte i = 0; i < aRecipe.length; i++) {
if (aRecipe[i] instanceof IItemContainer) aRecipe[i] = ((IItemContainer) aRecipe[i]).get(1);
else if (aRecipe[i] instanceof Enum) aRecipe[i] = ((Enum<?>) aRecipe[i]).name();
@@ -1542,7 +1543,6 @@ public class GT_ModHandler {
delayedRemovalByRecipe.add(aCrafting);
}
- @SuppressWarnings("unchecked")
public static void bulkRemoveByRecipe(List<InventoryCrafting> toRemove) {
ArrayList<IRecipe> tList = (ArrayList<IRecipe>) CraftingManager.getInstance()
.getRecipeList();
@@ -1699,8 +1699,7 @@ public class GT_ModHandler {
}
}
- if (tIndex == 2) {
- assert tStack1 != null && tStack2 != null;
+ if (tIndex == 2 && tStack2 != null) {
if (tStack1.getItem() == tStack2.getItem() && tStack1.stackSize == 1
&& tStack2.stackSize == 1
&& tStack1.getItem()
@@ -1733,7 +1732,6 @@ public class GT_ModHandler {
/**
* Gives you a copy of the Output from a Crafting Recipe Used for Recipe Detection.
*/
- @SuppressWarnings("unchecked")
public static ItemStack getRecipeOutput(boolean aUncopiedStack, boolean allowOreDict, ItemStack... aRecipe) {
if (aRecipe == null || Arrays.stream(aRecipe)
.noneMatch(Objects::nonNull)) return null;
@@ -1993,7 +1991,7 @@ public class GT_ModHandler {
*/
public static ItemStack[] getMachineOutput(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList,
boolean aRemoveInput, NBTTagCompound rRecipeMetaData, ItemStack... aOutputSlots) {
- if (aOutputSlots == null || aOutputSlots.length <= 0) return new ItemStack[0];
+ if (aOutputSlots == null || aOutputSlots.length == 0) return new ItemStack[0];
if (aInput == null) return new ItemStack[aOutputSlots.length];
try {
for (Entry<IRecipeInput, RecipeOutput> tEntry : aRecipeList.entrySet()) {
@@ -2136,8 +2134,6 @@ public class GT_ModHandler {
aCharge,
V[Math.max(0, Math.min(V.length - 1, tTier))] + B[Math.max(0, Math.min(V.length - 1, tTier))]);
if (aCharge > 0) {
- // int rCharge = Math.max(0, ic2.api.item.ElectricItem.manager.discharge(aStack, aCharge +
- // (aCharge * 4 > aTier ? aTier : 0), tTier, T, aSimulate));
int rCharge = (int) Math.max(
0,
ic2.api.item.ElectricItem.manager.discharge(
@@ -2197,13 +2193,12 @@ public class GT_ModHandler {
*/
public static boolean damageOrDechargeItem(ItemStack aStack, int aDamage, int aDecharge, EntityLivingBase aPlayer) {
if (GT_Utility.isStackInvalid(aStack) || (aStack.getMaxStackSize() <= 1 && aStack.stackSize > 1)) return false;
- if (aPlayer != null && aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode)
- return true;
+ if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) return true;
if (aStack.getItem() instanceof IDamagableItem) {
return ((IDamagableItem) aStack.getItem()).doDamageToItem(aStack, aDamage);
} else if (GT_ModHandler.isElectricItem(aStack)) {
if (canUseElectricItem(aStack, aDecharge)) {
- if (aPlayer != null && aPlayer instanceof EntityPlayer) {
+ if (aPlayer instanceof EntityPlayer) {
return GT_ModHandler.useElectricItem(aStack, aDecharge, (EntityPlayer) aPlayer);
}
return GT_ModHandler.dischargeElectricItem(aStack, aDecharge, Integer.MAX_VALUE, true, false, true)
diff --git a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java
index 85e423b032..d6be321854 100644
--- a/src/main/java/gregtech/api/util/GT_OreDictUnificator.java
+++ b/src/main/java/gregtech/api/util/GT_OreDictUnificator.java
@@ -44,7 +44,6 @@ public class GT_OreDictUnificator {
private static final Map<GT_ItemStack2, ItemData> sItemStack2DataMap = new HashMap<>();
private static final Map<GT_ItemStack2, List<ItemStack>> sUnificationTable = new HashMap<>();
private static final Set<GT_ItemStack2> sNoUnificationList = new HashSet<>();
- public static volatile int VERSION = 509;
private static int isRegisteringOre = 0, isAddingOre = 0;
private static boolean mRunThroughTheList = true;
@@ -114,16 +113,12 @@ public class GT_OreDictUnificator {
}
public static ItemStack get(OrePrefixes aPrefix, Object aMaterial, ItemStack aReplacement, long aAmount) {
- // if (Materials.mDefaultComponents.contains(aPrefix) && !aPrefix.mDynamicItems.contains((Materials)aMaterial))
- // aPrefix.mDynamicItems.add((Materials) aMaterial);
if (OrePrefixes.mPreventableComponents.contains(aPrefix) && aPrefix.mDisabledItems.contains(aMaterial))
return aReplacement;
return get(aPrefix.get(aMaterial), aReplacement, aAmount, false, true);
}
public static ItemStack get(OrePrefixes aPrefix, Object aMaterial, long aAmount, boolean aNoInvalidAmounts) {
- // if (Materials.mDefaultComponents.contains(aPrefix) && !aPrefix.mDynamicItems.contains((Materials)aMaterial))
- // aPrefix.mDynamicItems.add((Materials) aMaterial);
if (OrePrefixes.mPreventableComponents.contains(aPrefix) && aPrefix.mDisabledItems.contains(aMaterial))
return null;
return get(aPrefix.get(aMaterial), null, aAmount, false, aNoInvalidAmounts);
@@ -136,10 +131,6 @@ public class GT_OreDictUnificator {
if (stackFromName != null) return GT_Utility.copyAmount(aAmount, stackFromName);
if (aMentionPossibleTypos) {
GT_Log.err.println("Unknown Key for Unification, Typo? " + aName);
- // Debug callstack of entries not in sName2StackMap
- // StackTraceElement[] cause = Thread.currentThread().getStackTrace();
- // GT_Log.err.println(Arrays.toString(cause));
-
}
final ItemStack stackFirstOre = getFirstOre(aName, aAmount);
if (stackFirstOre != null) return GT_Utility.copyAmount(aAmount, stackFirstOre);
diff --git a/src/main/java/gregtech/api/util/GT_OverclockCalculator.java b/src/main/java/gregtech/api/util/GT_OverclockCalculator.java
index ab32772c78..ba90240f14 100644
--- a/src/main/java/gregtech/api/util/GT_OverclockCalculator.java
+++ b/src/main/java/gregtech/api/util/GT_OverclockCalculator.java
@@ -3,38 +3,38 @@ package gregtech.api.util;
public class GT_OverclockCalculator {
/**
- * @mAmps - Amperage of the multiblock
- * @mEUt - Voltage of the multiblock
- * @mRecipeEUt - Voltage the recipe will run at
- * @mRecipeAmps - The amount of amps the recipe needs
+ * mAmps - Amperage of the multiblock
+ * mEUt - Voltage of the multiblock
+ * mRecipeEUt - Voltage the recipe will run at
+ * mRecipeAmps - The amount of amps the recipe needs
*/
private long mAmps = 1, mEUt = 0, mRecipeEUt = 0, mRecipeAmps = 1;
/**
- * @mEUtDiscount - Discount for EUt at the beginning of calculating overclocks, like GT++ machines
- * @mSpeedBoost - Speeding/Slowing up/down the duration of a recipe at the beginning of calculating overclocks, like
- * GT++ machines
- * @mHeatDiscountAmont - The value used for discount final eut per 900 heat
+ * mEUtDiscount - Discount for EUt at the beginning of calculating overclocks, like GT++ machines
+ * mSpeedBoost - Speeding/Slowing up/down the duration of a recipe at the beginning of calculating overclocks, like
+ * GT++ machines
+ * mHeatDiscountAmount - The value used for discount final eut per 900 heat
*/
private float mEUtDiscount = 1, mSpeedBoost = 1, mHeatDiscountAmount = 0.95f;
/**
- * @mEUtIncreasePerOC - How much the bits should be moved to the left when it is overclocking (Going up, 2 meaning
- * it is multiplied with 4x)
- * @mDurationDecreasePerOC - How much the bits should be moved to the right when its overclocking (Going down, 1
- * meaning it is halved)
- * @mDuration - Duration of the recipe
- * @mParallel - The parallel the multi has when trying to overclock
- * @mRecipeHeat - The min heat required for the recipe
- * @mMultiHeat - The heat the multi has when starting the recipe
- * @mHeatPerfectOC - How much the bits should be moved to the right for each 1800 above recipe heat (Used for
- * duration)
+ * mEUtIncreasePerOC - How much the bits should be moved to the left when it is overclocking (Going up, 2 meaning
+ * it is multiplied with 4x)
+ * mDurationDecreasePerOC - How much the bits should be moved to the right when its overclocking (Going down, 1
+ * meaning it is halved)
+ * mDuration - Duration of the recipe
+ * mParallel - The parallel the multi has when trying to overclock
+ * mRecipeHeat - The min heat required for the recipe
+ * mMultiHeat - The heat the multi has when starting the recipe
+ * mHeatPerfectOC - How much the bits should be moved to the right for each 1800 above recipe heat (Used for
+ * duration)
*/
private int mEUtIncreasePerOC = 2, mDurationDecreasePerOC = 1, mDuration = 0, mParallel = 1, mRecipeHeat = 0,
mMultiHeat = 0, mHeatPerfectOC = 2;
/**
- * @mHeatOC - Whether to enable overclocking with heat like the EBF every 1800 heat difference
- * @mOneTickDiscount - Whether to give EUt Discount when the duration goes below one tick
- * @calculates - variable to check whether the overclocks have been calculated
- * @mHeatDiscount - Whether to enable heat discounts every 900 heat difference
+ * mHeatOC - Whether to enable overclocking with heat like the EBF every 1800 heat difference
+ * mOneTickDiscount - Whether to give EUt Discount when the duration goes below one tick
+ * calculates - variable to check whether the overclocks have been calculated
+ * mHeatDiscount - Whether to enable heat discounts every 900 heat difference
*/
private boolean mHeatOC, mOneTickDiscount, calculated, mHeatDiscount;
@@ -261,7 +261,7 @@ public class GT_OverclockCalculator {
if (mOneTickDiscount) {
int voltageDifference = GT_Utility.getTier(mEUt) - GT_Utility.getTier(mRecipeEUt);
- mRecipeEUt >>= voltageDifference * mDurationDecreasePerOC;
+ mRecipeEUt >>= (long) voltageDifference * mDurationDecreasePerOC;
if (mRecipeEUt < 1) {
mRecipeEUt = 1;
}
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index 43dfd0c5b2..4e8db694af 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -1,27 +1,50 @@
package gregtech.api.util;
-import static gregtech.api.enums.GT_Values.*;
+import static gregtech.api.enums.GT_Values.D1;
+import static gregtech.api.enums.GT_Values.D2;
+import static gregtech.api.enums.GT_Values.E;
+import static gregtech.api.enums.GT_Values.L;
+import static gregtech.api.enums.GT_Values.W;
import static gregtech.api.enums.Mods.GTPlusPlus;
import static gregtech.api.enums.Mods.GregTech;
import static gregtech.api.enums.Mods.NEICustomDiagrams;
import static gregtech.api.enums.Mods.Railcraft;
import static gregtech.api.util.GT_RecipeBuilder.handleRecipeCollision;
import static gregtech.api.util.GT_RecipeConstants.ADDITIVE_AMOUNT;
-import static gregtech.api.util.GT_RecipeMapUtil.*;
+import static gregtech.api.util.GT_RecipeMapUtil.FIRST_FLUIDSTACK_INPUT;
+import static gregtech.api.util.GT_RecipeMapUtil.FIRST_FLUIDSTACK_OUTPUT;
+import static gregtech.api.util.GT_RecipeMapUtil.FIRST_FLUID_OUTPUT;
+import static gregtech.api.util.GT_RecipeMapUtil.FIRST_ITEM_INPUT;
+import static gregtech.api.util.GT_RecipeMapUtil.FIRST_ITEM_OR_FLUID_INPUT;
+import static gregtech.api.util.GT_RecipeMapUtil.FIRST_ITEM_OR_FLUID_OUTPUT;
+import static gregtech.api.util.GT_RecipeMapUtil.FIRST_ITEM_OUTPUT;
+import static gregtech.api.util.GT_RecipeMapUtil.GT_RecipeTemplate;
+import static gregtech.api.util.GT_RecipeMapUtil.SPECIAL_VALUE_ALIASES;
+import static gregtech.api.util.GT_RecipeMapUtil.asTemplate;
+import static gregtech.api.util.GT_RecipeMapUtil.buildOrEmpty;
import static gregtech.api.util.GT_Utility.formatNumbers;
import static gregtech.api.util.GT_Utility.isArrayEmptyOrNull;
import static gregtech.api.util.GT_Utility.isArrayOfLength;
import static net.minecraft.util.EnumChatFormatting.GRAY;
import static net.minecraft.util.StatCollector.translateToLocal;
-import java.awt.*;
-import java.util.*;
+import java.awt.Rectangle;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.client.Minecraft;
@@ -67,8 +90,15 @@ import gnu.trove.map.TByteObjectMap;
import gnu.trove.map.hash.TByteObjectHashMap;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.*;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.Element;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.SteamVariant;
+import gregtech.api.enums.SubTag;
import gregtech.api.gui.GT_GUIColorOverride;
import gregtech.api.gui.modularui.FallbackableSteamTexture;
import gregtech.api.gui.modularui.GT_UITextures;
@@ -111,7 +141,6 @@ import mods.railcraft.common.items.RailcraftToolItems;
*/
public class GT_Recipe implements Comparable<GT_Recipe> {
- public static volatile int VERSION = 509;
/**
* If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs,
* please add a new Recipe, because of the HashMaps.
@@ -912,7 +941,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
/**
* THIS CONSTRUCTOR DOES SET THE PERSISTENT HASH.
- *
+ * <p>
* if you set one yourself, it will give you one of the RunetimeExceptions!
*/
public GT_Recipe_AssemblyLine(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs,
@@ -941,7 +970,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
/**
* THIS CONSTRUCTOR DOES <b>NOT</b> SET THE PERSISTENT HASH.
- *