Skip to content

Commit

Permalink
Mekanism Integration, Changed the License to MPL 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
WanionCane committed Jul 17, 2016
1 parent a0570e0 commit b2b699e
Show file tree
Hide file tree
Showing 45 changed files with 602 additions and 609 deletions.
842 changes: 373 additions & 469 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "1.10.2-1.2d"
version = "1.10.2-1.3"
group= "wanion.unidict" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "UniDict"

Expand Down
19 changes: 11 additions & 8 deletions src/main/java/wanion/unidict/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import com.google.common.collect.Sets;
Expand All @@ -31,10 +31,10 @@ private Config() {}

// config
private static final Configuration config = new Configuration(new File("." + SLASH + "config" + SLASH + Reference.MOD_NAME + ".cfg"), Reference.MOD_VERSION);
public static final Set<String> keepOneEntryModBlackSet = Collections.unmodifiableSet(Sets.newLinkedHashSet(Arrays.asList(config.getStringList("keepOneEntryModBlackList", Configuration.CATEGORY_GENERAL, new String[]{}, "mods listed here will be blacklisted in keepOneEntry.\nmust be the exact modID."))));
// general configs
private static final String general = Configuration.CATEGORY_GENERAL;
public static final boolean keepOneEntry = config.getBoolean("keepOneEntry", general, false, "keep only one entry per ore dict entry?");
public static final Set<String> keepOneEntryModBlackSet = Collections.unmodifiableSet(Sets.newLinkedHashSet(Arrays.asList(config.getStringList("keepOneEntryModBlackList", general, new String[]{}, "mods listed here will be blacklisted in keepOneEntry.\nmust be the exact modID."))));
public static boolean autoHideInJEI;
public static final Set<String> hideInJEIBlackSet = Collections.unmodifiableSet(Sets.newLinkedHashSet(Arrays.asList(config.getStringList("autoHideInJEIBlackList", general, new String[]{"ore"}, "put here things that you don't want to hide in JEI.\nonly works if keepOneEntry is false."))));
// resource related stuff
Expand All @@ -46,12 +46,13 @@ private Config() {}
public static final List<String> resourceBlackList = Arrays.asList(config.getStringList("resourceBlackList", resources, new String[]{"Aluminium"}, "resources to be black-listed.\nthis exists to avoid duplicates.\nthis affect the API."));
public static final Map<String, Set<String>> customUnifiedResources = Collections.unmodifiableMap(getCustomUnifiedResourcesMap());
// modules
private static final String modules = "modules";
static final boolean integrationModule = config.getBoolean("integration", modules, true, "Integration Module enabled?\nif false all the Integrations will be disabled.\nthis will affect non-standalone tweak.\n");
static final boolean integrationModule = config.getBoolean("integration", "modules", true, "Integration Module enabled?\nif false all the Integrations will be disabled.\n");
// vanilla integrations
private static final String vanillaIntegrations = "vanillaIntegrations";
public static final boolean craftingIntegration = config.getBoolean("craftingIntegration", vanillaIntegrations, true, "Crafting Integration");
public static final boolean furnaceIntegration = config.getBoolean("furnaceIntegration", vanillaIntegrations, true, "Furnace Integration");
public static final boolean craftingIntegration = config.getBoolean("craftingIntegration", "vanillaIntegrations", true, "Crafting Integration");
public static final boolean furnaceIntegration = config.getBoolean("furnaceIntegration", "vanillaIntegrations", true, "Furnace Integration");
// ore gen integration
//public static final boolean oreGenIntegration = config.getBoolean("enabled", "oreGenIntegration", false, "Ore Gen Integration (alpha)\nbe sure to keep enabled all the ore generation in the configuration of other mods, because this will compensate the missing ores.");
//public static final int oreGenIntegrationRadius = config.getInt("radius", "oreGenIntegration", 3, 1, 32, "this is the radius (square root) of chuncks that the profiling of Ore Gen integration will use;\nhigher values means more accuracy, but in exchange of a really long loading time;\nthe profiling is done only once.");
// ensure mod loaded
public static boolean ic2;
// integration
Expand All @@ -61,6 +62,7 @@ private Config() {}
public static boolean enderIOIntegration;
public static boolean foundryIntegration;
public static boolean ic2Integration;
public static boolean mekanismIntegration;
public static boolean techRebornIntegration;
public static boolean techyIntegration;

Expand All @@ -86,6 +88,7 @@ static void init()
//forestryIntegration = config.getBoolean("forestry", integrations, true, "Forestry Integration.") && forestry;
foundryIntegration = config.getBoolean("foundry", integrations, true, "Foundry Integration.") && isModLoaded("foundry");
ic2Integration = config.getBoolean("industrialCraft2", integrations, true, "Industrial Craft 2 Integration.") && ic2;
mekanismIntegration = config.getBoolean("mekanism", integrations, true, "Mekanism Integration.");
techRebornIntegration = config.getBoolean("techReborn", integrations, true, "TechReborn Integration.") && isModLoaded("techreborn");
techyIntegration = config.getBoolean("techy", integrations, true, "Techy Integration.") && isModLoaded("Techy");
} catch (Exception e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/LoadStage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import net.minecraftforge.fml.common.event.*;
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/wanion/unidict/MetaItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import gnu.trove.list.TIntList;
Expand Down Expand Up @@ -63,6 +63,14 @@ else if (object instanceof List && !((List) object).isEmpty())
return cumulativeKey;
}

public static int getCumulative(final ItemStack... itemStacks)
{
int cumulativeKey = 0;
for (final ItemStack itemStack : itemStacks)
cumulativeKey += get(itemStack);
return cumulativeKey;
}

public static int[] getArray(final Collection<ItemStack> itemStackCollection)
{
return getList(itemStackCollection).toArray();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/UniDict.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import net.minecraftforge.fml.common.Mod;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/UniJEIPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import mezz.jei.api.*;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/UniOreDictionary.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import gnu.trove.map.TIntObjectMap;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/api/UniDictAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import gnu.trove.map.hash.THashMap;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/api/helper/FoundryUniHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import exter.foundry.api.recipe.ICastingRecipe;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/api/helper/TConUniHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import net.minecraft.item.ItemStack;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/common/Dependencies.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import javax.annotation.Nonnull;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/common/FixedSizeList.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import javax.annotation.Nonnull;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/common/Instantiator.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

@FunctionalInterface
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/wanion/unidict/common/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import static java.io.File.separatorChar;
Expand All @@ -14,7 +14,7 @@ public final class Reference
{
public static final String MOD_ID = "UniDict";
public static final String MOD_NAME = MOD_ID;
public static final String MOD_VERSION = "1.10.2-1.2e";
public static final String MOD_VERSION = "1.10.2-1.3";
public static final char SLASH = separatorChar;
public static final String MC_VERSION = "[1.10.2]";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import gnu.trove.map.TLongObjectMap;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/common/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import net.minecraft.item.Item;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/helper/KindHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import gnu.trove.map.TIntLongMap;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wanion/unidict/helper/RecipeHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import gnu.trove.map.TObjectCharMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import wanion.unidict.LoadStage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import com.shinoow.abyssalcraft.api.recipe.TransmutatorRecipes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import cyano.basemetals.registry.CrusherRecipeRegistry;
Expand Down
56 changes: 19 additions & 37 deletions src/main/java/wanion/unidict/integration/CraftingIntegration.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 1.1. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/1.1/.
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import com.google.common.collect.Lists;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import wanion.unidict.Config;
import wanion.unidict.UniDict;
Expand All @@ -24,8 +23,10 @@
import wanion.unidict.recipe.VanillaResearcher;
import wanion.unidict.resource.UniResourceContainer;

import javax.annotation.Nonnull;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

final class CraftingIntegration extends AbstractIntegrationThread
{
Expand Down Expand Up @@ -76,37 +77,18 @@ private void doTheResearch()
else evenSmarterRecipeMap.get(recipeKey).add(bufferRecipe);
recipeIterator.remove();
}
smartRecipeMap.forEach((container, evenSmartRecipeMap) -> {
final Comparator<IRecipe> recipeComparator = new RecipeComparator(container.getComparator());
evenSmartRecipeMap.forEachValue(recipeList -> {
recipeList.sort(recipeComparator);
final IRecipe recipe = recipeList.get(0);
final boolean isShapeless = shapelessResearcherMap.containsKey(recipe.getClass());
final IRecipeResearcher<? extends IRecipe, ? extends IRecipe> recipeResearcher = !isShapeless ? shapedResearcherMap.get(recipe.getClass()) : shapelessResearcherMap.get(recipe.getClass());
if (recipe.getRecipeSize() == 9)
recipes.add(isShapeless ? recipeResearcher.getNewShapedFromShapelessRecipe(recipe, resourceHandler, uniOreDictionary) : recipeResearcher.getNewShapedRecipe(recipe, resourceHandler, uniOreDictionary));
else if (recipe.getRecipeSize() == 1)
recipes.add(isShapeless ? recipeResearcher.getNewShapelessRecipe(recipe, resourceHandler, uniOreDictionary) : recipeResearcher.getNewShapelessFromShapedRecipe(recipe, resourceHandler, uniOreDictionary));
else
recipes.add(isShapeless ? recipeResearcher.getNewShapelessRecipe(recipe, resourceHandler, uniOreDictionary) : recipeResearcher.getNewShapedRecipe(recipe, resourceHandler, uniOreDictionary));
return true;
});
});
}

private static final class RecipeComparator implements Comparator<IRecipe>
{
private final Comparator<ItemStack> itemStackComparator;

private RecipeComparator(@Nonnull final Comparator<ItemStack> itemStackComparator)
{
this.itemStackComparator = itemStackComparator;
}

@Override
public int compare(IRecipe recipe1, IRecipe recipe2)
{
return itemStackComparator.compare(recipe1.getRecipeOutput(), recipe2.getRecipeOutput());
}
smartRecipeMap.forEach((container, evenSmartRecipeMap) -> evenSmartRecipeMap.forEachValue(recipeList -> {
final IRecipe recipe = recipeList.get(0);
final boolean isShapeless = shapelessResearcherMap.containsKey(recipe.getClass());
final IRecipeResearcher<? extends IRecipe, ? extends IRecipe> recipeResearcher = !isShapeless ? shapedResearcherMap.get(recipe.getClass()) : shapelessResearcherMap.get(recipe.getClass());
if (recipe.getRecipeSize() == 9)
recipes.add(isShapeless ? recipeResearcher.getNewShapedFromShapelessRecipe(recipe, resourceHandler, uniOreDictionary) : recipeResearcher.getNewShapedRecipe(recipe, resourceHandler, uniOreDictionary));
else if (recipe.getRecipeSize() == 1)
recipes.add(isShapeless ? recipeResearcher.getNewShapelessRecipe(recipe, resourceHandler, uniOreDictionary) : recipeResearcher.getNewShapelessFromShapedRecipe(recipe, resourceHandler, uniOreDictionary));
else
recipes.add(isShapeless ? recipeResearcher.getNewShapelessRecipe(recipe, resourceHandler, uniOreDictionary) : recipeResearcher.getNewShapedRecipe(recipe, resourceHandler, uniOreDictionary));
return true;
})
);
}
}
Loading

0 comments on commit b2b699e

Please sign in to comment.