diff options
author | minecraft7771 <maxim235@gmx.de> | 2023-02-16 21:09:35 +0100 |
---|---|---|
committer | minecraft7771 <maxim235@gmx.de> | 2023-02-16 21:09:35 +0100 |
commit | 5fcd96ae9bc7e0846f3c03e10731024378aa8b47 (patch) | |
tree | b51c7365b4f4fe6053cc8bff03993595a261c405 /src/main | |
parent | 5b503c38d1f35874ced360890417e53d6a219eab (diff) | |
parent | ca2921bb10732d32f52e2782f06b1bf1d0e3215d (diff) | |
download | GT5-Unofficial-5fcd96ae9bc7e0846f3c03e10731024378aa8b47.tar.gz GT5-Unofficial-5fcd96ae9bc7e0846f3c03e10731024378aa8b47.tar.bz2 GT5-Unofficial-5fcd96ae9bc7e0846f3c03e10731024378aa8b47.zip |
Merge branch 'master' into fix/MultipleEOHFixes
Diffstat (limited to 'src/main')
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())); } } } |