Skip to content

Commit

Permalink
Updating files from 1.10.2 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
fangedhex committed Jun 18, 2017
2 parents 0425945 + 542faf0 commit a8657e3
Show file tree
Hide file tree
Showing 9 changed files with 197 additions and 8 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ compileJava {
minecraft {
version = "1.11.2-13.20.0.2282"
runDir = "run"

// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
Expand All @@ -38,7 +38,7 @@ dependencies {
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"

// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
Expand All @@ -65,11 +65,11 @@ processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}

// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
Expand Down
Binary file added libs/CoFHCore-1.11.2-4.2.0.2-universal.jar
Binary file not shown.
Binary file added libs/CodeChickenLib-1.11.2-2.7.0.268-deobf.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 @@ -20,4 +20,4 @@ public final class Reference
public static final String MC_VERSION = "[1.11.2]";

private Reference() {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ protected void init()
private enum Integration
{
CRAFTING(CraftingIntegration.class),
FURNACE(FurnaceIntegration.class),
FURNACE(FurnaceIntegration.class),
ABYSSAL_CRAFT("abyssalcraft", AbyssalCraftIntegration.class),
ADVANCED_ROCKETRY("advancedrocketry", AdvancedRocketryIntegration.class),
BLOOD_MAGIC("bloodmagic", BloodMagicIntegration.class),
EMBERS("embers", EmbersIntegration.class),
INDUSTRIAL_CRAFT_2("ic2", IC2Integration.class),
REFINED_STORAGE("refinedstorage", RefinedStorageIntegration.class, false),
THERMAL_EXPANSION("thermalexpansion", TEIntegration.class),
TECH_REBORN("techreborn", TechRebornIntegration.class);

private final String modId;
Expand All @@ -73,4 +74,4 @@ private enum Integration
this.enabledByDefault = enabledByDefault;
}
}
}
}
188 changes: 188 additions & 0 deletions src/main/java/wanion/unidict/integration/TEIntegration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
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 cofh.thermalexpansion.util.managers.machine.*;
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;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

final class TEIntegration extends AbstractIntegrationThread
{
TEIntegration()
{
super("Thermal Expansion");
}

@Override
public String call()
{
try {
fixCompactorRecipes();
fixRefineryRecipes();
fixInductionSmelterRecipes();
fixRedstoneFurnaceRecipes();
fixPulverizerRecipes();
} catch (Exception e) {
UniDict.getLogger().error(threadName + e);
}
return threadName + "The world seems to be more thermally involved.";
}

private void fixCompactorRecipes()
{
final Map<CompactorManager.ComparableItemStackCompactor, CompactorManager.RecipeCompactor> recipeMapPress = Util.getField(CompactorManager.class, "recipeMapPress", null, Map.class);
final Map<CompactorManager.ComparableItemStackCompactor, CompactorManager.RecipeCompactor> recipeMapStorage = Util.getField(CompactorManager.class, "recipeMapStorage", null, Map.class);
if (recipeMapPress == null || recipeMapStorage == null)
return;
Constructor<CompactorManager.RecipeCompactor> recipeCompactorConstructor = null;
try {
recipeCompactorConstructor = CompactorManager.RecipeCompactor.class.getDeclaredConstructor(ItemStack.class, ItemStack.class, int.class);
recipeCompactorConstructor.setAccessible(true);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
if (recipeCompactorConstructor == null)
return;
final List<Map<CompactorManager.ComparableItemStackCompactor, CompactorManager.RecipeCompactor>> recipeMaps = new ArrayList<>();
recipeMaps.add(recipeMapPress);
recipeMaps.add(recipeMapStorage);
for (final Map<CompactorManager.ComparableItemStackCompactor, CompactorManager.RecipeCompactor> recipeMap : recipeMaps)
for (final CompactorManager.ComparableItemStackCompactor recipeMapKey : recipeMap.keySet()) {
final CompactorManager.RecipeCompactor recipeCompactor = recipeMap.get(recipeMapKey);
final ItemStack correctOutput = resourceHandler.getMainItemStack(recipeCompactor.getOutput());
if (correctOutput == recipeCompactor.getOutput())
continue;
try {
recipeMap.put(recipeMapKey, recipeCompactorConstructor.newInstance(recipeCompactor.getInput(), correctOutput, recipeCompactor.getEnergy()));
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}

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 = Util.getField(FurnaceManager.class, "recipeMap", null, Map.class);
if (recipeMap == null)
return;
Constructor<FurnaceManager.RecipeFurnace> redstoneFurnaceRecipeConstructor = null;
try {
redstoneFurnaceRecipeConstructor = FurnaceManager.RecipeFurnace.class.getDeclaredConstructor(ItemStack.class, ItemStack.class, int.class);
redstoneFurnaceRecipeConstructor.setAccessible(true);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
if (redstoneFurnaceRecipeConstructor == null)
return;
for (final FurnaceManager.ComparableItemStackFurnace recipeMapKey : recipeMap.keySet()) {
final FurnaceManager.RecipeFurnace redstoneFurnaceRecipe = recipeMap.get(recipeMapKey);
final ItemStack correctOutput = resourceHandler.getMainItemStack(redstoneFurnaceRecipe.getOutput());
if (correctOutput == redstoneFurnaceRecipe.getOutput())
continue;
try {
recipeMap.put(recipeMapKey, redstoneFurnaceRecipeConstructor.newInstance(redstoneFurnaceRecipe.getInput(), correctOutput, redstoneFurnaceRecipe.getEnergy()));
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}

private void fixPulverizerRecipes()
{
final Map<PulverizerManager.ComparableItemStackPulverizer, PulverizerManager.RecipePulverizer> recipeMap = Util.getField(PulverizerManager.class, "recipeMap", null, Map.class);
if (recipeMap == null)
return;
Constructor<PulverizerManager.RecipePulverizer> pulverizerRecipeConstructor = null;
try {
pulverizerRecipeConstructor = PulverizerManager.RecipePulverizer.class.getDeclaredConstructor(ItemStack.class, ItemStack.class, ItemStack.class, int.class, int.class);
pulverizerRecipeConstructor.setAccessible(true);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
if (pulverizerRecipeConstructor == null)
return;
for (final PulverizerManager.ComparableItemStackPulverizer recipeMapKey : recipeMap.keySet()) {
final PulverizerManager.RecipePulverizer pulverizerRecipe = recipeMap.get(recipeMapKey);
final ItemStack correctOutput = resourceHandler.getMainItemStack(pulverizerRecipe.getPrimaryOutput());
final ItemStack correctSecondaryOutput = resourceHandler.getMainItemStack(pulverizerRecipe.getSecondaryOutput());
if (correctOutput == pulverizerRecipe.getPrimaryOutput() && correctSecondaryOutput == pulverizerRecipe.getSecondaryOutput())
continue;
try {
recipeMap.put(recipeMapKey, pulverizerRecipeConstructor.newInstance(pulverizerRecipe.getInput(), correctOutput, correctSecondaryOutput, pulverizerRecipe.getSecondaryOutputChance(), pulverizerRecipe.getEnergy()));
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"screenshots": [],
"dependencies": []
}
]
]

0 comments on commit a8657e3

Please sign in to comment.