diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-10-10 17:45:37 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-10-10 17:45:37 +0100 |
commit | ab84b1d95f8c4880891debc594a41f57941de78a (patch) | |
tree | c3bcdbda25cb0d45028dff77944d3e5fbff7edcd /src/Java/gtPlusPlus/core/item | |
parent | 89d30a5cfcc2d3d5773647350edf913f156062b3 (diff) | |
download | GT5-Unofficial-ab84b1d95f8c4880891debc594a41f57941de78a.tar.gz GT5-Unofficial-ab84b1d95f8c4880891debc594a41f57941de78a.tar.bz2 GT5-Unofficial-ab84b1d95f8c4880891debc594a41f57941de78a.zip |
+ Added some new functions to ReflectionUtils.java.
+ Added an alternative way to Obtain Blizz rods, dust and Cryotheum dust if GalaxySpace is loaded. Closes #557.
$ Fixed bug in DecayableRecipeHandler.java.
$ Fixed instance where I was directly referencing forestry code.
$ Rewrote how canning/uncanning recipes are handled, hopefully fixes the corruption of the recipe map.
> I potentially broke some of my own canning recipes, so be aware of any missing and let me know.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r-- | src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java | 27 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java | 8 |
2 files changed, 23 insertions, 12 deletions
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java index 0c2bdaa3ef..87158fe4ee 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.item.chemistry; +import java.lang.reflect.Field; import java.util.ArrayList; import forestry.plugins.PluginCore; @@ -14,6 +15,7 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -334,13 +336,24 @@ public class AgriculturalChem extends ItemPackage { * Forestry Support */ if (LoadedMods.Forestry) { - - Item aForestryFert = PluginCore.items.fertilizerCompound; - - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedCircuit(11), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, - null, new ItemStack[] { ItemUtils.getSimpleStack(aForestryFert, 3), aManureByprod, aManureByprod }, - new int[] { 10000, 2000, 2000 }, 20 * 20, 240); + Field aItemField = ReflectionUtils.getField(ReflectionUtils.getClass("forestry.plugins.PluginCore"), "items"); + try { + Object aItemRegInstance = aItemField != null ? aItemField.get(aItemField) : null; + if (aItemRegInstance != null) { + Field aFertField = ReflectionUtils.getField(aItemRegInstance.getClass(), "fertilizerCompound"); + Object aItemInstance = aFertField.get(aItemRegInstance); + if (aItemInstance instanceof Item) { + Item aForestryFert = (Item) aItemInstance; + CORE.RA.addDehydratorRecipe( + new ItemStack[] { CI.getNumberedCircuit(11), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, + null, new ItemStack[] { ItemUtils.getSimpleStack(aForestryFert, 3), aManureByprod, aManureByprod }, + new int[] { 10000, 2000, 2000 }, 20 * 20, 240); + } + } + } + catch (IllegalArgumentException | IllegalAccessException e) { + + } } /** diff --git a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java index 46837be310..0e21387c56 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java @@ -1,8 +1,5 @@ package gtPlusPlus.core.item.chemistry; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -12,12 +9,13 @@ import gtPlusPlus.api.objects.minecraft.ItemPackage; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.AddGregtechRecipe; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -429,7 +427,7 @@ public class CoalTar extends ItemPackage { else { Toluene = FluidUtils.getWildcardFluidStack("Toluene", 1).getFluid(); Item itemCellToluene = new BaseItemComponent("Toluene", "Toluene", new short[]{140, 70, 20, 100}); - MaterialGenerator.addFluidCannerRecipe(ItemUtils.getEmptyCell(), ItemUtils.getSimpleStack(itemCellToluene), FluidUtils.getFluidStack(Toluene, 1000), null); + CORE.RA.addFluidCannerRecipe(ItemUtils.getEmptyCell(), ItemUtils.getSimpleStack(itemCellToluene), FluidUtils.getFluidStack(Toluene, 1000), null); } //Create Coal Tar |