Skip to content

Commit

Permalink
New: Chickens Integration(Chickens)
Browse files Browse the repository at this point in the history
New: per entry JEI Hiding.
New: Added support for "Fractionating Still"  on Thermal Expansion Integration (thanks, BloodWorkXGaming).
 Disabled: Temporally disabled Calculator Integration, due to changes on Calculator (it was already off by default)
 Fixed: TechReborn Integration, since some TechReborn Update, it was broken.
 Updated: All the Dependencies.
  • Loading branch information
WanionCane committed Mar 22, 2017
1 parent 3eb37cc commit 217fbb1
Show file tree
Hide file tree
Showing 48 changed files with 137 additions and 75 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.


version = "1.10.2-2.7"
version = "1.10.2-2.8"
group= "wanion.unidict" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "UniDict"

Expand All @@ -21,7 +21,7 @@ compileJava {
}

minecraft {
version = "1.10.2-12.18.3.2185"
version = "1.10.2-12.18.3.2254"
runDir = "run"

// the mappings can be changed at any time, and must be in the following format.
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed libs/EnderCore-1.10.2-0.4.1.61-beta.jar
Binary file not shown.
Binary file added libs/EnderCore-1.10.2-0.4.1.65-beta.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed libs/MCMultiPart-1.3.0-universal.jar
Binary file not shown.
Binary file added libs/MCMultiPart-1.4.0-deobf.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added libs/MoreChickens-1.10.2-1.0.11.jar
Binary file not shown.
Binary file added libs/RebornCore-1.10.2-2.13.5.136-dev.jar
Binary file not shown.
Binary file removed libs/RebornCore-1.10.2-2.8.4.78-dev.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed libs/TechReborn-1.10.2-1.4.16.133-dev.jar
Binary file not shown.
Binary file added libs/TechReborn-1.10.2-2.1.10.207-dev.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added libs/chickens-4.3.2.jar
Binary file not shown.
Binary file removed libs/embers-0.016.jar
Binary file not shown.
Binary file added libs/embers-0.104.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions src/main/java/wanion/unidict/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TObjectIntHashMap;
import net.minecraftforge.common.config.Configuration;
import org.apache.commons.lang3.text.WordUtils;
import wanion.unidict.common.Reference;
import wanion.unidict.resource.Resource;

import java.io.File;
import java.util.*;
Expand All @@ -32,7 +30,8 @@ public final class Config implements UniDict.IDependency
public final boolean registerNewCraftingIngredientsAsItemStacks;
public final Set<String> keepOneEntryModBlackSet;
public final boolean autoHideInJEI;
public final Set<String> hideInJEIBlackSet;
public final Set<String> hideInJEIKindBlackSet;
public final Set<String> hideInJEIEntryBlackSet;
// dumps
public final boolean kindsDump;
public final boolean entriesDump;
Expand Down Expand Up @@ -75,7 +74,8 @@ private Config()
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."))));
registerNewCraftingIngredientsAsItemStacks = config.getBoolean("registerNewCraftingIngredientsAsItemStacks", general, false, "If Enabled, the ingredients of all the new recipes created by Crafting Integration will be registered as ItemStacks.\nEnable this if you don't like the cycling through the possibilities of JEI.");
autoHideInJEI = config.getBoolean("autoHideInJEI", general, true, "auto hide items in JEI?") && isModLoaded("JEI");
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."))));
hideInJEIKindBlackSet = Collections.unmodifiableSet(Sets.newLinkedHashSet(Arrays.asList(config.getStringList("autoHideInJEIKindBlackList", general, new String[]{"ore"}, "put here kinds that you don't want to hide in JEI.\nonly works if keepOneEntry is false."))));
hideInJEIEntryBlackSet = Collections.unmodifiableSet(Sets.newLinkedHashSet(Arrays.asList(config.getStringList("autoHideInJEIEntryBlackList", general, new String[]{}, "put here entries that you don't want to hide in JEI.\nonly works if keepOneEntry is false."))));
// dumps
kindsDump = config.getBoolean("kindsDump", "dump", false, "Enable this to keep track of all the kinds.\nthe output file will be saved on \"config\\unidict\\dump\" folder.\nonce the file is generated, you must delete it to re-generate.");
entriesDump = config.getBoolean("entriesDump", "dump", false, "Enable this to keep track of all the entries.\nthe output file will be saved on \"config\\unidict\\dump\" folder.\nonce the file is generated, you must delete it to re-generate.");
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/wanion/unidict/UniDict.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ public void postInit(final FMLPostInitializationEvent event)
{
uniResourceHandler.postInit();
moduleHandler.startModules(event);
}

@Mod.EventHandler
public void loadComplete(final FMLLoadCompleteEvent event)
{
moduleHandler.startModules(event);
uniResourceHandler = null;
moduleHandler = null;
dependencies = null;
Expand All @@ -114,8 +108,6 @@ private ModuleHandler populateModules(final ModuleHandler moduleHandler)
final Config config = getConfig();
if (!config.libraryMode && config.integrationModule)
moduleHandler.addModule(new IntegrationModule());
//if (config.processingModule)
// moduleHandler.addModule(new ProcessingModule());
return moduleHandler;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/wanion/unidict/common/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public final class Reference
{
public static final String MOD_ID = "unidict";
public static final String MOD_NAME = "UniDict";
public static final String MOD_VERSION = "1.10.2-2.7";
public static final String MOD_VERSION = "1.10.2-2.8";
public static final String DEPENDENCIES = "required-after:wanionlib@[1.10.2-1.3,);after:*";
public static final char SLASH = separatorChar;
public static final String MC_VERSION = "[1.10.2]";
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/wanion/unidict/integration/AE2Integration.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public String call()
{
try {
fixGrindStoneRecipes();
} catch (Exception e) {
UniDict.getLogger().error(threadName + e);
}
} catch (Exception e) { UniDict.getLogger().error(threadName + e); }
return threadName + "The world of energistics has never been so powerful.";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public String call()
try {
fixAlchemyTableRecipes();
} catch (Exception e) { UniDict.getLogger().error(threadName + e); }
return threadName + "It is bleeding...";
return threadName + "It's bleeding...";
}

private void fixAlchemyTableRecipes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import sonar.calculator.mod.common.recipes.machines.AlgorithmSeparatorRecipes;
import sonar.calculator.mod.common.recipes.machines.StoneSeparatorRecipes;
import wanion.unidict.UniDict;

final class CalculatorIntegration extends AbstractIntegrationThread
Expand All @@ -31,11 +29,11 @@ public String call()

private void fixStoneSeparatorRecipes()
{
StoneSeparatorRecipes.instance().getRecipes().values().forEach(resourceHandler::setMainItemStacks);
//StoneSeparatorRecipes.instance().getRecipes().values().forEach(resourceHandler::setMainItemStacks);
}

private void fixAlgorithmSeparatorRecipes()
{
AlgorithmSeparatorRecipes.instance().getRecipes().values().forEach(resourceHandler::setMainItemStacks);
//AlgorithmSeparatorRecipes.instance().getRecipes().forEach(resourceHandler::setMainItemStacks);
}
}
34 changes: 34 additions & 0 deletions src/main/java/wanion/unidict/integration/ChickensIntegration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package wanion.unidict.integration;

/*
* Created by WanionCane(https://github.com/WanionCane).
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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.setycz.chickens.ChickensRegistry;
import wanion.unidict.UniDict;

final class ChickensIntegration extends AbstractIntegrationThread
{
ChickensIntegration()
{
super("Chickens");
}

@Override
public String call()
{
try {
ChickensRegistry.getItems().forEach(chickensRegistryItem -> {
chickensRegistryItem.setLayItem(resourceHandler.getMainItemStack(chickensRegistryItem.createLayItem()));
chickensRegistryItem.setDropItem(resourceHandler.getMainItemStack(chickensRegistryItem.createDropItem()));
});
} catch (Exception e) {
UniDict.getLogger().error(threadName + e);
}
return threadName + "changed Chicken's DNA to eggs give the right things when hatched.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ private enum Integration
APPLIED_ENERGISTICS_2("appliedenergistics2", AE2Integration.class),
BASE_METALS("basemetals", BaseMetalsIntegration.class),
BLOOD_MAGIC("BloodMagic", BloodMagicIntegration.class),
CALCULATOR("Calculator", CalculatorIntegration.class, false),
//CALCULATOR("calculator", CalculatorIntegration.class, false),
CHICKENS("chickens", ChickensIntegration.class),
EMBERS("embers", EmbersIntegration.class),
ENDER_IO("EnderIO", EnderIOIntegration.class),
FORESTRY("forestry", ForestryIntegration.class),
Expand Down
99 changes: 63 additions & 36 deletions src/main/java/wanion/unidict/integration/TEIntegration.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import cofh.thermalexpansion.util.crafting.CompactorManager;
import cofh.thermalexpansion.util.crafting.FurnaceManager;
import cofh.thermalexpansion.util.crafting.PulverizerManager;
import cofh.thermalexpansion.util.crafting.SmelterManager;
import com.google.common.collect.Lists;
import cofh.thermalexpansion.util.crafting.*;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import wanion.lib.common.Util;
import wanion.unidict.UniDict;

Expand All @@ -35,9 +34,10 @@ public String call()
{
try {
fixCompactorRecipes();
fixRefineryRecipes();
fixInductionSmelterRecipes();
fixRedstoneFurnaceRecipes();
fixPulverizerRecipes();
fixInductionSmelterRecipes();
} catch (Exception e) {
UniDict.getLogger().error(threadName + e);
}
Expand Down Expand Up @@ -76,9 +76,64 @@ private void fixCompactorRecipes()
}
}

private void fixInductionSmelterRecipes()
{
final Map<List<SmelterManager.ComparableItemStackSmelter>, SmelterManager.RecipeSmelter> recipeMap = Util.getField(SmelterManager.class, "recipeMap", null, Map.class);
if (recipeMap == null)
return;
Constructor<SmelterManager.RecipeSmelter> smelterRecipeConstructor = null;
try {
smelterRecipeConstructor = SmelterManager.RecipeSmelter.class.getDeclaredConstructor(ItemStack.class, ItemStack.class, ItemStack.class, ItemStack.class, int.class, int.class);
smelterRecipeConstructor.setAccessible(true);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
if (smelterRecipeConstructor == null)
return;
for (final List<SmelterManager.ComparableItemStackSmelter> recipeMapKey : recipeMap.keySet()) {
final SmelterManager.RecipeSmelter smelterRecipe = recipeMap.get(recipeMapKey);
final ItemStack correctOutput = resourceHandler.getMainItemStack(smelterRecipe.getPrimaryOutput());
final ItemStack correctSecondaryOutput = resourceHandler.getMainItemStack(smelterRecipe.getSecondaryOutput());
if (correctOutput == smelterRecipe.getPrimaryOutput() && correctSecondaryOutput == smelterRecipe.getSecondaryOutput())
continue;
try {
recipeMap.put(recipeMapKey, smelterRecipeConstructor.newInstance(smelterRecipe.getPrimaryInput(), smelterRecipe.getSecondaryInput(), correctOutput, correctSecondaryOutput, smelterRecipe.getSecondaryOutputChance(), smelterRecipe.getEnergy()));
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}

private void fixRefineryRecipes()
{
final TIntObjectHashMap<RefineryManager.RecipeRefinery> recipeMap = Util.getField(RefineryManager.class, "recipeMap", null, TIntObjectMap.class);
if (recipeMap == null)
return;
Constructor<RefineryManager.RecipeRefinery> refineryRecipeConstructor = null;
try {
refineryRecipeConstructor = RefineryManager.RecipeRefinery.class.getDeclaredConstructor(FluidStack.class, FluidStack.class, ItemStack.class, int.class);
refineryRecipeConstructor.setAccessible(true);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
if (refineryRecipeConstructor == null)
return;
for (final int recipeMapKey : recipeMap.keys()) {
final RefineryManager.RecipeRefinery refineryRecipe = recipeMap.get(recipeMapKey);
final ItemStack correctOutput = resourceHandler.getMainItemStack(refineryRecipe.getOutputItem());
if (correctOutput == refineryRecipe.getOutputItem())
continue;
try {
recipeMap.put(recipeMapKey, refineryRecipeConstructor.newInstance(refineryRecipe.getInput(), refineryRecipe.getOutputFluid(), correctOutput, refineryRecipe.getEnergy()));
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}

private void fixRedstoneFurnaceRecipes()
{
final Map<FurnaceManager.ComparableItemStackFurnace, FurnaceManager.RecipeFurnace> recipeMap = wanion.lib.common.Util.getField(FurnaceManager.class, "recipeMap", null, Map.class);
final Map<FurnaceManager.ComparableItemStackFurnace, FurnaceManager.RecipeFurnace> recipeMap = Util.getField(FurnaceManager.class, "recipeMap", null, Map.class);
if (recipeMap == null)
return;
Constructor<FurnaceManager.RecipeFurnace> redstoneFurnaceRecipeConstructor = null;
Expand All @@ -105,7 +160,7 @@ private void fixRedstoneFurnaceRecipes()

private void fixPulverizerRecipes()
{
final Map<PulverizerManager.ComparableItemStackPulverizer, PulverizerManager.RecipePulverizer> recipeMap = wanion.lib.common.Util.getField(PulverizerManager.class, "recipeMap", null, Map.class);
final Map<PulverizerManager.ComparableItemStackPulverizer, PulverizerManager.RecipePulverizer> recipeMap = Util.getField(PulverizerManager.class, "recipeMap", null, Map.class);
if (recipeMap == null)
return;
Constructor<PulverizerManager.RecipePulverizer> pulverizerRecipeConstructor = null;
Expand All @@ -130,32 +185,4 @@ private void fixPulverizerRecipes()
}
}
}

private void fixInductionSmelterRecipes()
{
final Map<List<SmelterManager.ComparableItemStackSmelter>, SmelterManager.RecipeSmelter> recipeMap = Util.getField(SmelterManager.class, "recipeMap", null, Map.class);
if (recipeMap == null)
return;
Constructor<SmelterManager.RecipeSmelter> smelterRecipeConstructor = null;
try {
smelterRecipeConstructor = SmelterManager.RecipeSmelter.class.getDeclaredConstructor(ItemStack.class, ItemStack.class, ItemStack.class, ItemStack.class, int.class, int.class);
smelterRecipeConstructor.setAccessible(true);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
if (smelterRecipeConstructor == null)
return;
for (final List<SmelterManager.ComparableItemStackSmelter> recipeMapKey : recipeMap.keySet()) {
final SmelterManager.RecipeSmelter smelterRecipe = recipeMap.get(recipeMapKey);
final ItemStack correctOutput = resourceHandler.getMainItemStack(smelterRecipe.getPrimaryOutput());
final ItemStack correctSecondaryOutput = resourceHandler.getMainItemStack(smelterRecipe.getSecondaryOutput());
if (correctOutput == smelterRecipe.getPrimaryOutput() && correctSecondaryOutput == smelterRecipe.getSecondaryOutput())
continue;
try {
recipeMap.put(recipeMapKey, smelterRecipeConstructor.newInstance(smelterRecipe.getPrimaryInput(), smelterRecipe.getSecondaryInput(), correctOutput, correctSecondaryOutput, smelterRecipe.getSecondaryOutputChance(), smelterRecipe.getEnergy()));
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private void fixTechRebornRecipes()
{
RecipeHandler.recipeList.forEach(recipe -> {
if (!recipe.useOreDic())
resourceHandler.setMainItemStacks(recipe.getInputs());
resourceHandler.setMainObjects(recipe.getInputs());
resourceHandler.setMainItemStacks(recipe.getOutputs());
});
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/wanion/unidict/resource/ResourceHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ public void setMainItemStacks(@Nonnull final List<ItemStack> thingList)
thingList.set(i, getMainItemStack(thingList.get(i)));
}

public void setMainObjects(@Nonnull final List<Object> thingList)
{
for (int i = 0; i < thingList.size(); i++)
if (thingList.get(i) instanceof ItemStack)
thingList.set(i, getMainItemStack((ItemStack) thingList.get(i)));
}

public ItemStack[] getMainItemStacks(@Nonnull final ItemStack[] things)
{
for (int i = 0; i < things.length; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private void keepOneEntry()
return;
final Set<ItemStack> keepOneEntryBlackSet = ResourceHandler.keepOneEntryBlackSet;
if (!keepOneEntryBlackSet.isEmpty()) {
for (Iterator<ItemStack> keepOneEntryIterator = entries.subList(1, entries.size()).iterator(); keepOneEntryIterator.hasNext(); )
for (final Iterator<ItemStack> keepOneEntryIterator = entries.subList(1, entries.size()).iterator(); keepOneEntryIterator.hasNext(); )
if (!keepOneEntryBlackSet.contains(keepOneEntryIterator.next()))
keepOneEntryIterator.remove();
} else entries.subList(1, entries.size()).clear();
Expand All @@ -107,7 +107,7 @@ private void removeBadEntriesFromJEI()
if (entries.size() > 1)
if (UniDict.getConfig().keepOneEntry)
entries.subList(1, entries.size()).forEach(UniJEIPlugin::hide);
else if (!UniResourceHandler.getKindBlackSet().contains(kind))
else if (!UniResourceHandler.getEntryJEIBlackSet().contains(name) || !UniResourceHandler.getKindJEIBlackSet().contains(kind))
entries.subList(1, entries.size()).forEach(UniJEIPlugin::hide);
}

Expand Down
Loading

0 comments on commit 217fbb1

Please sign in to comment.