From f45b9dfb65c7c7b353797eca4be9c2885eb69e85 Mon Sep 17 00:00:00 2001 From: miozune Date: Thu, 16 Feb 2023 21:11:14 +0900 Subject: Remove unused EMRecipeMap --- .../elementalMatter/core/recipes/EMRecipeMap.java | 73 ---------------------- 1 file changed, 73 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/mechanics/elementalMatter/core/recipes/EMRecipeMap.java (limited to 'src/main') 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 { // TODO FIX - // Multimap for multiple recipes from the same thing - you know parameters might differ the output - - private final Map>> recipes; - - public EMRecipeMap() { - recipes = new HashMap<>(); - } - - public EMRecipe put(EMRecipe in) { - Map> 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... contents) { - for (EMRecipe recipe : contents) { - put(recipe); - } - } - - public EMRecipe remove(IEMMapRead map, int id) { - Map> 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> remove(IEMMapRead 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> findExact(IEMMapRead 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> findMatch(IEMMapRead in) { - for (Map.Entry>> cElementalDefinitionStackMapHashMapEntry : getRecipes() - .entrySet()) { - if (in.containsAllAmounts(cElementalDefinitionStackMapHashMapEntry.getKey())) { - return cElementalDefinitionStackMapHashMapEntry.getValue(); - } - } - return null; - } - - public Map>> getRecipes() { - return recipes; - } - - // To check for instance data and other things use recipe extensions! -} -- cgit From d4971ee872e4186da6361c9afd86133304b7ae8d Mon Sep 17 00:00:00 2001 From: miozune Date: Thu, 16 Feb 2023 21:11:38 +0900 Subject: Fix EOH recipes not being generated in some dimensions --- .../technus/tectech/recipe/EyeOfHarmonyRecipe.java | 31 +++++++++++-------- .../tectech/recipe/EyeOfHarmonyRecipeStorage.java | 35 +++++++++------------- 2 files changed, 32 insertions(+), 34 deletions(-) (limited to 'src/main') 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> 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())); } } } -- cgit