-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from FangedHex/1.11.2
Some changes for the 1.11.2
- Loading branch information
Showing
13 changed files
with
261 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ public final class Reference | |
public static final String MC_VERSION = "[1.11.2]"; | ||
|
||
private Reference() {} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/wanion/unidict/integration/AdvancedRocketryIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
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 net.minecraft.item.ItemStack; | ||
import wanion.unidict.UniDict; | ||
import zmaster587.libVulpes.recipe.RecipesMachine; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.List; | ||
|
||
final class AdvancedRocketryIntegration extends AbstractIntegrationThread | ||
{ | ||
private final Field outputField; | ||
AdvancedRocketryIntegration() | ||
{ | ||
super("Advanced Rocketry"); | ||
try { | ||
(outputField = RecipesMachine.Recipe.class.getDeclaredField("output")).setAccessible(true); | ||
} catch (NoSuchFieldException e) { | ||
throw new RuntimeException("Couldn't find the fields!"); | ||
} | ||
} | ||
|
||
@Override | ||
public String call() | ||
{ | ||
try { | ||
fixRecipes(); | ||
} catch (Exception e) { | ||
UniDict.getLogger().error(threadName + e); | ||
} | ||
return threadName + "10. 9...3 2 1... BOOOOM!!"; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
private void fixRecipes() | ||
{ | ||
RecipesMachine.getInstance().recipeList.values().forEach(iRecipes -> iRecipes.forEach(iRecipe -> { | ||
if (iRecipe instanceof RecipesMachine.Recipe) | ||
try { | ||
resourceHandler.setMainItemStacks((List<ItemStack>) outputField.get(iRecipe)); | ||
} catch (IllegalAccessException e) { | ||
e.printStackTrace(); | ||
} | ||
})); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
188 changes: 188 additions & 0 deletions
188
src/main/java/wanion/unidict/integration/TEIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
"screenshots": [], | ||
"dependencies": [] | ||
} | ||
] | ||
] |