aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus')
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/ForestryTreeHandler.java94
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java1
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_ChemicalSkips.java67
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java103
4 files changed, 137 insertions, 128 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/ForestryTreeHandler.java b/src/main/java/gtPlusPlus/xmod/forestry/ForestryTreeHandler.java
new file mode 100644
index 0000000000..1f64eacb5c
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/ForestryTreeHandler.java
@@ -0,0 +1,94 @@
+package gtPlusPlus.xmod.forestry;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import binnie.extratrees.genetics.ExtraTreeSpecies;
+import forestry.api.arboriculture.EnumGermlingType;
+import forestry.api.arboriculture.EnumWoodType;
+import forestry.api.arboriculture.ITree;
+import forestry.api.arboriculture.TreeManager;
+import forestry.arboriculture.genetics.TreeDefinition;
+import forestry.plugins.PluginArboriculture;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntityTreeFarm;
+
+public class ForestryTreeHandler {
+
+ public static void generateForestryTrees() {
+ for (TreeDefinition tree : TreeDefinition.values()) {
+ String speciesUID = tree.getUID();
+
+ ItemStack sapling = tree.getMemberStack(EnumGermlingType.SAPLING);
+
+ ItemStack log;
+ EnumWoodType woodType = ReflectionUtils.getField(tree, "woodType");
+ if (woodType != null) {
+ log = TreeManager.woodItemAccess.getLog(woodType, false);
+ } else {
+ log = ReflectionUtils.getField(tree, "vanillaWood");
+ }
+
+ ItemStack leaves = new ItemStack(PluginArboriculture.blocks.leaves, 1, 0);
+ if (speciesUID != null) {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ nbtTagCompound.setString("species", speciesUID);
+ leaves.setTagCompound(nbtTagCompound);
+ }
+
+ ItemStack fruit = null;
+ ITree individual = tree.getIndividual();
+ if (individual.canBearFruit()) {
+ ItemStack[] produceList = individual.getProduceList();
+ if (produceList != null && produceList.length > 0) {
+ fruit = individual.getProduceList()[0];
+ }
+ }
+
+ GregtechMetaTileEntityTreeFarm.registerForestryTree(
+ speciesUID,
+ sapling == null ? null : sapling.copy(),
+ log == null ? null : log.copy(),
+ leaves == null ? null : leaves.copy(),
+ fruit == null ? null : fruit.copy());
+ }
+ }
+
+ public static void generateExtraTreesTrees() {
+ for (ExtraTreeSpecies species : ExtraTreeSpecies.values()) {
+
+ String speciesUID = species.getUID();
+
+ ITree individual = TreeManager.treeRoot.templateAsIndividual(species.getTemplate());
+ ItemStack sapling = TreeManager.treeRoot.getMemberStack(individual, 0);
+
+ ItemStack log = null;
+ if (species.getLog() != null) {
+ log = species.getLog()
+ .getItemStack();
+ }
+
+ ItemStack leaves = new ItemStack(PluginArboriculture.blocks.leaves, 1, 0);
+ if (speciesUID != null) {
+ NBTTagCompound nbtTagCompound = new NBTTagCompound();
+ nbtTagCompound.setString("species", speciesUID);
+ leaves.setTagCompound(nbtTagCompound);
+ }
+
+ ItemStack fruit = null;
+ if (individual.canBearFruit()) {
+ ItemStack[] produceList = individual.getProduceList();
+ if (produceList != null && produceList.length > 0) {
+ fruit = individual.getProduceList()[0];
+ }
+ }
+
+ GregtechMetaTileEntityTreeFarm.registerForestryTree(
+ speciesUID,
+ sapling == null ? null : sapling.copy(),
+ log == null ? null : log.copy(),
+ leaves == null ? null : leaves.copy(),
+ fruit == null ? null : fruit.copy());
+ }
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java b/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java
index a1b96d0f2f..dc2d277283 100644
--- a/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java
+++ b/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java
@@ -20,4 +20,5 @@ public class HANDLER_FR {
new GTPP_Bees();
}
}
+
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_ChemicalSkips.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_ChemicalSkips.java
index e4071c018d..5789f5be03 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_ChemicalSkips.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_ChemicalSkips.java
@@ -28,6 +28,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.MaterialsKevlar;
import gregtech.api.enums.MaterialsUEVplus;
+import gregtech.api.enums.Mods;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.TierEU;
import gregtech.api.util.GT_ModHandler;
@@ -334,38 +335,40 @@ public class RecipeLoader_ChemicalSkips {
.eut(TierEU.RECIPE_UIV)
.metadata(QFT_FOCUS_TIER, 4)
.addTo(quantumForceTransformerRecipes);
- // Lategame Kevlar using Kevlar bee comb
- GT_Values.RA.stdBuilder()
- .itemInputs(
- GT_Bees.combs.getStackForType(CombType.KEVLAR, 24),
- Materials.Carbon.getDust(64),
- ItemUtils.getSimpleStack(GenericChem.mUltimatePlasticCatalyst, 0))
- .fluidInputs(Materials.Nitrogen.getGas(1000 * 16), Materials.Hydrogen.getGas(1000 * 16))
- .fluidOutputs(
- MaterialsKevlar.PolyurethaneResin.getFluid(1000 * 32),
- MaterialsKevlar.LiquidCrystalKevlar.getFluid(144 * 32),
- MaterialsKevlar.Kevlar.getMolten(144 * 64))
- .duration(20 * SECONDS)
- .eut(TierEU.RECIPE_UIV)
- .metadata(QFT_FOCUS_TIER, 4)
- .addTo(quantumForceTransformerRecipes);
- // Platline skip using Platline Combs (Palladium, Osmium, Iridium, Platinum)
- GT_Values.RA.stdBuilder()
- .itemInputs(
- GT_Bees.combs.getStackForType(CombType.PLATINUM, 32),
- GT_Bees.combs.getStackForType(CombType.PALLADIUM, 32),
- GT_Bees.combs.getStackForType(CombType.OSMIUM, 32),
- GT_Bees.combs.getStackForType(CombType.IRIDIUM, 32),
- ItemUtils.getSimpleStack(GenericChem.mPlatinumGroupCatalyst, 0))
- .fluidOutputs(
- Materials.Osmium.getMolten(144 * 256),
- Materials.Palladium.getMolten(144 * 256),
- Materials.Iridium.getMolten(144 * 256),
- Materials.Platinum.getMolten(144 * 256))
- .duration(20 * SECONDS)
- .eut(TierEU.RECIPE_UV)
- .metadata(QFT_FOCUS_TIER, 1)
- .addTo(quantumForceTransformerRecipes);
+ if (Mods.Forestry.isModLoaded()) {
+ // Lategame Kevlar using Kevlar bee comb
+ GT_Values.RA.stdBuilder()
+ .itemInputs(
+ GT_Bees.combs.getStackForType(CombType.KEVLAR, 24),
+ Materials.Carbon.getDust(64),
+ ItemUtils.getSimpleStack(GenericChem.mUltimatePlasticCatalyst, 0))
+ .fluidInputs(Materials.Nitrogen.getGas(1000 * 16), Materials.Hydrogen.getGas(1000 * 16))
+ .fluidOutputs(
+ MaterialsKevlar.PolyurethaneResin.getFluid(1000 * 32),
+ MaterialsKevlar.LiquidCrystalKevlar.getFluid(144 * 32),
+ MaterialsKevlar.Kevlar.getMolten(144 * 64))
+ .duration(20 * SECONDS)
+ .eut(TierEU.RECIPE_UIV)
+ .metadata(QFT_FOCUS_TIER, 4)
+ .addTo(quantumForceTransformerRecipes);
+ // Platline skip using Platline Combs (Palladium, Osmium, Iridium, Platinum)
+ GT_Values.RA.stdBuilder()
+ .itemInputs(
+ GT_Bees.combs.getStackForType(CombType.PLATINUM, 32),
+ GT_Bees.combs.getStackForType(CombType.PALLADIUM, 32),
+ GT_Bees.combs.getStackForType(CombType.OSMIUM, 32),
+ GT_Bees.combs.getStackForType(CombType.IRIDIUM, 32),
+ ItemUtils.getSimpleStack(GenericChem.mPlatinumGroupCatalyst, 0))
+ .fluidOutputs(
+ Materials.Osmium.getMolten(144 * 256),
+ Materials.Palladium.getMolten(144 * 256),
+ Materials.Iridium.getMolten(144 * 256),
+ Materials.Platinum.getMolten(144 * 256))
+ .duration(20 * SECONDS)
+ .eut(TierEU.RECIPE_UV)
+ .metadata(QFT_FOCUS_TIER, 1)
+ .addTo(quantumForceTransformerRecipes);
+ }
// Bio Cells and Mutated Solder
GT_Values.RA.stdBuilder()
.itemInputs(
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java
index c69a26326f..1026f24538 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java
@@ -3,18 +3,10 @@ package gtPlusPlus.xmod.gregtech.loaders.recipe;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-
-import binnie.extratrees.genetics.ExtraTreeSpecies;
-import forestry.api.arboriculture.EnumGermlingType;
-import forestry.api.arboriculture.EnumWoodType;
-import forestry.api.arboriculture.ITree;
-import forestry.api.arboriculture.TreeManager;
-import forestry.arboriculture.genetics.TreeDefinition;
-import forestry.plugins.PluginArboriculture;
+
import gregtech.api.enums.Mods;
import gregtech.api.util.GT_ModHandler;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.forestry.ForestryTreeHandler;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntityTreeFarm;
public class RecipeLoader_TreeFarm {
@@ -41,8 +33,11 @@ public class RecipeLoader_TreeFarm {
if (Mods.PamsHarvestCraft.isModLoaded()) generatePamsTrees();
if (Mods.PamsHarvestTheNether.isModLoaded()) generatePamsNetherTrees();
- if (Mods.Forestry.isModLoaded()) generateForestryTrees();
- if (Mods.ExtraTrees.isModLoaded()) generateExtraTreesTrees();
+ if (Mods.Forestry.isModLoaded()) {
+ ForestryTreeHandler.generateForestryTrees();
+ }
+
+ if (Mods.Forestry.isModLoaded() && Mods.ExtraTrees.isModLoaded()) ForestryTreeHandler.generateExtraTreesTrees();
}
private static void generateVanillaTrees() {
@@ -632,88 +627,4 @@ public class RecipeLoader_TreeFarm {
null);
}
- /*
- * Abdiel Kavash: I do not claim the code in the following two methods to be ideal, or to even completely understand
- * all the details. Much of it has been copied from the previous version, available at
- * https://github.com/GTNewHorizons/GTplusplus/blob/dca836fee368878cf64ca59e4c7ffc5875a3f489/src/main/java/
- * gtPlusPlus/xmod/forestry/HANDLER_FR.java#L60. If anybody understands Forestry and/or Extra Trees internals better
- * than I do, and knows a more straightforward way to retrieve the relevant ItemStacks here, please update this.
- */
-
- private static void generateForestryTrees() {
- for (TreeDefinition tree : TreeDefinition.values()) {
- String speciesUID = tree.getUID();
-
- ItemStack sapling = tree.getMemberStack(EnumGermlingType.SAPLING);
-
- ItemStack log;
- EnumWoodType woodType = ReflectionUtils.getField(tree, "woodType");
- if (woodType != null) {
- log = TreeManager.woodItemAccess.getLog(woodType, false);
- } else {
- log = ReflectionUtils.getField(tree, "vanillaWood");
- }
-
- ItemStack leaves = new ItemStack(PluginArboriculture.blocks.leaves, 1, 0);
- if (speciesUID != null) {
- NBTTagCompound nbtTagCompound = new NBTTagCompound();
- nbtTagCompound.setString("species", speciesUID);
- leaves.setTagCompound(nbtTagCompound);
- }
-
- ItemStack fruit = null;
- ITree individual = tree.getIndividual();
- if (individual.canBearFruit()) {
- ItemStack[] produceList = individual.getProduceList();
- if (produceList != null && produceList.length > 0) {
- fruit = individual.getProduceList()[0];
- }
- }
-
- GregtechMetaTileEntityTreeFarm.registerForestryTree(
- speciesUID,
- sapling == null ? null : sapling.copy(),
- log == null ? null : log.copy(),
- leaves == null ? null : leaves.copy(),
- fruit == null ? null : fruit.copy());
- }
- }
-
- private static void generateExtraTreesTrees() {
- for (ExtraTreeSpecies species : ExtraTreeSpecies.values()) {
-
- String speciesUID = species.getUID();
-
- ITree individual = TreeManager.treeRoot.templateAsIndividual(species.getTemplate());
- ItemStack sapling = TreeManager.treeRoot.getMemberStack(individual, 0);
-
- ItemStack log = null;
- if (species.getLog() != null) {
- log = species.getLog()
- .getItemStack();
- }
-
- ItemStack leaves = new ItemStack(PluginArboriculture.blocks.leaves, 1, 0);
- if (speciesUID != null) {
- NBTTagCompound nbtTagCompound = new NBTTagCompound();
- nbtTagCompound.setString("species", speciesUID);
- leaves.setTagCompound(nbtTagCompound);
- }
-
- ItemStack fruit = null;
- if (individual.canBearFruit()) {
- ItemStack[] produceList = individual.getProduceList();
- if (produceList != null && produceList.length > 0) {
- fruit = individual.getProduceList()[0];
- }
- }
-
- GregtechMetaTileEntityTreeFarm.registerForestryTree(
- speciesUID,
- sapling == null ? null : sapling.copy(),
- log == null ? null : log.copy(),
- leaves == null ? null : leaves.copy(),
- fruit == null ? null : fruit.copy());
- }
- }
}