aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java73
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java31
-rw-r--r--src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java35
3 files changed, 32 insertions, 107 deletions
diff --git a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java b/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java
deleted file mode 100644
index 2aad1b9e40..0000000000
--- a/src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.github.technus.tectech.mechanics.elementalMatter.core.recipes;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.EMConstantStackMap;
-import com.github.technus.tectech.mechanics.elementalMatter.core.maps.IEMMapRead;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.EMDefinitionStack;
-import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.IEMStack;
-
-/**
- * Created by Tec on 02.03.2017.
- */
-public class EMRecipeMap<T> { // TODO FIX
- // Multimap for multiple recipes from the same thing - you know parameters might differ the output
-
- private final Map<EMConstantStackMap, Map<Integer, EMRecipe<T>>> recipes;
-
- public EMRecipeMap() {
- recipes = new HashMap<>();
- }
-
- public EMRecipe<T> put(EMRecipe<T> in) {
- Map<Integer, EMRecipe<T>> r = getRecipes().computeIfAbsent(in.getInEM(), k -> new HashMap<>());
- return r.put(in.getID(), in); // IF THIS RETURN SHIT, it means that inputs are using the exact same types of
- // matter as input -
- // (non amount wise collision)
- // It is either bad, or unimportant if you use different id's
- }
-
- public void putAll(EMRecipe<T>... contents) {
- for (EMRecipe<T> recipe : contents) {
- put(recipe);
- }
- }
-
- public EMRecipe<T> remove(IEMMapRead<EMDefinitionStack> map, int id) {
- Map<Integer, EMRecipe<T>> recipesMap = getRecipes().get(map);
- return recipesMap != null ? recipesMap.remove(id) : null; // todo check, suspicious but ok, equals and hashcode
- // methods are adjusted for that
- }
-
- public Map<Integer, EMRecipe<T>> remove(IEMMapRead<EMDefinitionStack> map) {
- return getRecipes().remove(map); // todo check, suspicious but ok, equals and hashcode methods are adjusted for
- // that
- }
-
- // Recipe founding should not check amounts - this checks if the types of matter in map are equal to any recipe!
- // Return a recipeShortMap when the content of input is equal (ignoring amounts and instance data)
- @Deprecated
- public Map<Integer, EMRecipe<T>> findExact(IEMMapRead<? extends IEMStack> in) {
- return getRecipes().get(in); // suspicious but ok, equals and hashcode methods are adjusted for that
- }
-
- // this does check if the map contains all the requirements for any recipe, and the required amounts
- // Return a recipeShortMap when the content of input matches the recipe input - does not ignore amounts but ignores
- // instance data!
- public Map<Integer, EMRecipe<T>> findMatch(IEMMapRead<? extends IEMStack> in) {
- for (Map.Entry<EMConstantStackMap, Map<Integer, EMRecipe<T>>> cElementalDefinitionStackMapHashMapEntry : getRecipes()
- .entrySet()) {
- if (in.containsAllAmounts(cElementalDefinitionStackMapHashMapEntry.getKey())) {
- return cElementalDefinitionStackMapHashMapEntry.getValue();
- }
- }
- return null;
- }
-
- public Map<EMConstantStackMap, Map<Integer, EMRecipe<T>>> getRecipes() {
- return recipes;
- }
-
- // To check for instance data and other things use recipe extensions!
-}
diff --git a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
index 99f25832eb..98f24260eb 100644
--- a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
+++ b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java
@@ -270,6 +270,7 @@ public class EyeOfHarmonyRecipe {
public static void processHelper(HashMapHelper outputMap, Materials material, double mainMultiplier,
double probability) {
+ if (material == null) return;
outputMap.add(material.mDirectSmelting, (material.mOreMultiplier * 2) * mainMultiplier * probability);
int index = 0;
@@ -287,21 +288,25 @@ public class EyeOfHarmonyRecipe {
double mainMultiplier = timeInSeconds * 384.0;
- normalOreDimWrapper.oreVeinToProbabilityInDimension.forEach((veinInfo, probability) -> {
- processHelper(outputMap, veinInfo.mPrimaryVeinMaterial, mainMultiplier, probability);
- processHelper(outputMap, veinInfo.mSecondaryMaterial, mainMultiplier, probability);
- // 8.0 to replicate void miner getDropsVanillaVeins method yields.
- processHelper(outputMap, veinInfo.mBetweenMaterial, mainMultiplier / 8.0, probability);
- processHelper(outputMap, veinInfo.mSporadicMaterial, mainMultiplier / 8.0, probability);
- });
+ if (normalOreDimWrapper != null) {
+ normalOreDimWrapper.oreVeinToProbabilityInDimension.forEach((veinInfo, probability) -> {
+ processHelper(outputMap, veinInfo.mPrimaryVeinMaterial, mainMultiplier, probability);
+ processHelper(outputMap, veinInfo.mSecondaryMaterial, mainMultiplier, probability);
+ // 8.0 to replicate void miner getDropsVanillaVeins method yields.
+ processHelper(outputMap, veinInfo.mBetweenMaterial, mainMultiplier / 8.0, probability);
+ processHelper(outputMap, veinInfo.mSporadicMaterial, mainMultiplier / 8.0, probability);
+ });
+ }
// Iterate over small ores in dimension and add them, kinda hacky but works and is close enough.
- smallOreDimWrapper.oreVeinToProbabilityInDimension.forEach(
- (veinInfo, probability) -> processHelper(
- outputMap,
- veinInfo.getOreMaterial(),
- mainMultiplier,
- probability));
+ if (smallOreDimWrapper != null) {
+ smallOreDimWrapper.oreVeinToProbabilityInDimension.forEach(
+ (veinInfo, probability) -> processHelper(
+ outputMap,
+ veinInfo.getOreMaterial(),
+ mainMultiplier,
+ probability));
+ }
ArrayList<Pair<Materials, Long>> outputList = new ArrayList<>();
diff --git a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java
index cd5d20aed6..78e97f4c46 100644
--- a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java
+++ b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipeStorage.java
@@ -51,30 +51,23 @@ public class EyeOfHarmonyRecipeStorage {
.getOrDefault(dimAbbreviation, null);
GT5OreSmallHelper.SmallOreDimensionWrapper smallOre = GT5OreSmallHelper.dimToSmallOreWrapper
.getOrDefault(dimAbbreviation, null);
-
- if ((normalOre == null) || (smallOre == null)) {
- System.out.println(
- dimAbbreviation
- + " dimension not found in dimToOreWrapper. Report error to GTNH team.");
+ if (normalOre == null && smallOre == null) {
+ // no ores are generated in this dimension. fail silently
continue;
}
- try {
- put(
- dimAbbreviation,
- new EyeOfHarmonyRecipe(
- normalOre,
- smallOre,
- blockDimensionDisplay,
- 0.6 + blockDimensionDisplay.getDimensionRocketTier() / 10.0,
- BILLION * (blockDimensionDisplay.getDimensionRocketTier() + 1),
- BILLION * (blockDimensionDisplay.getDimensionRocketTier() + 1),
- timeCalculator(blockDimensionDisplay.getDimensionRocketTier()),
- blockDimensionDisplay.getDimensionRocketTier(),
- 1.0 - 0.05 * blockDimensionDisplay.getDimensionRocketTier()));
- } catch (Exception e) {
- e.printStackTrace();
- }
+ put(
+ dimAbbreviation,
+ new EyeOfHarmonyRecipe(
+ normalOre,
+ smallOre,
+ blockDimensionDisplay,
+ 0.6 + blockDimensionDisplay.getDimensionRocketTier() / 10.0,
+ BILLION * (blockDimensionDisplay.getDimensionRocketTier() + 1),
+ BILLION * (blockDimensionDisplay.getDimensionRocketTier() + 1),
+ timeCalculator(blockDimensionDisplay.getDimensionRocketTier()),
+ blockDimensionDisplay.getDimensionRocketTier(),
+ 1.0 - 0.05 * blockDimensionDisplay.getDimensionRocketTier()));
}
}
}