Skip to content

Commit 51d823a

Browse files
committed
Merge branch 'main' into gregificationMultiFarm
2 parents 3b02069 + ce76933 commit 51d823a

9 files changed

Lines changed: 106 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# v1.2.0
2+
- Add Forestry Multifarm support for GregTech/GTFO saplings and GT fertilizer [#11](https://github.com/GTModpackTeam/GTBeesMatrix/pull/11)
3+
4+
* * *
5+
6+
# v1.1.1
7+
- Fix recipe conflict with GTFO [#8](https://github.com/GTModpackTeam/GTBeesMatrix/pull/8)
8+
9+
* * *
10+
111
# v1.1.0
212
- Addition of items that can be changed in cfg. [#7](https://github.com/GTModpackTeam/GTBeesMatrix/pull/7)
313

buildscript.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ modGroup = com.github.gtexpert.gtbm
77

88
# Version of your mod.
99
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
10-
modVersion = 1.1.1-beta
10+
modVersion = 1.2.0-beta
1111

1212
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
1313
includeMCVersionJar = true

dependencies.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ dependencies {
9696
}
9797

9898
// Debug GTFO: 1.12.5
99+
compileOnly rfg.deobf("curse.maven:gregtech-food-option-477021:6472136")
99100
if (project.debug_all.toBoolean() || project.debug_gtfo.toBoolean()) {
100101
runtimeOnly rfg.deobf("curse.maven:gregtech-food-option-477021:6472136")
101102
}

src/main/java/com/github/gtexpert/gtbm/integration/forestry/ForestryModule.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.github.gtexpert.gtbm.api.modules.TModule;
99
import com.github.gtexpert.gtbm.api.util.Mods;
1010
import com.github.gtexpert.gtbm.integration.GTBMIntegrationSubmodule;
11+
import com.github.gtexpert.gtbm.integration.forestry.loaders.FFMFarmingLoader;
1112
import com.github.gtexpert.gtbm.integration.forestry.loaders.FFMOreDictionaryLoader;
1213
import com.github.gtexpert.gtbm.integration.forestry.recipes.*;
1314
import com.github.gtexpert.gtbm.integration.forestry.recipes.machines.*;
@@ -29,6 +30,8 @@ public void postInit(FMLPostInitializationEvent event) {
2930
FFMToolRecipe.init();
3031
FFMCraftingRecipe.init();
3132

33+
FFMFarmingLoader.init();
34+
3235
CarpenterLoader.initBase();
3336
CarpenterLoader.initMode();
3437
CentrifugeLoader.init();
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.github.gtexpert.gtbm.integration.forestry.loaders;
2+
3+
import net.minecraft.item.ItemStack;
4+
5+
import gregtech.common.blocks.MetaBlocks;
6+
import gregtech.common.items.MetaItems;
7+
8+
import forestry.api.core.ForestryAPI;
9+
import forestry.api.farming.IFarmRegistry;
10+
import forestry.farming.logic.farmables.FarmableSapling;
11+
12+
public class FFMFarmingLoader {
13+
14+
public static void init() {
15+
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
16+
17+
// GregTech Rubber Sapling
18+
farmRegistry.registerFarmables("farmArboreal",
19+
new FarmableSapling(new ItemStack(MetaBlocks.RUBBER_SAPLING), new ItemStack[0]));
20+
21+
// GregTech Fertilizer
22+
farmRegistry.registerFertilizer(MetaItems.FERTILIZER.getStackForm(), 500);
23+
}
24+
}

src/main/java/com/github/gtexpert/gtbm/integration/forestry/recipes/FFMMaterialsRecipe.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
package com.github.gtexpert.gtbm.integration.forestry.recipes;
22

3+
import net.minecraft.item.ItemStack;
4+
import net.minecraftforge.fluids.FluidStack;
5+
6+
import gregtech.api.recipes.GTRecipeHandler;
37
import gregtech.api.recipes.ModHandler;
8+
import gregtech.api.recipes.RecipeMaps;
9+
import gregtech.api.unification.OreDictUnifier;
10+
import gregtech.api.unification.material.Materials;
11+
import gregtech.api.unification.ore.OrePrefix;
12+
import gregtech.common.items.MetaItems;
413

514
import com.github.gtexpert.gtbm.api.util.Mods;
615

@@ -49,6 +58,23 @@ public static void materialsCore() {
4958

5059
// Apatite Block
5160
ModHandler.removeRecipeByName(Mods.Forestry.getResource("apatite_block"));
61+
62+
// Remove GT Fertilizer -> Forestry fertilizer_compound bulk recipes
63+
GTRecipeHandler.removeRecipesByInputs(RecipeMaps.MIXER_RECIPES,
64+
new ItemStack[] {
65+
MetaItems.FERTILIZER.getStackForm(8),
66+
OreDictUnifier.get(OrePrefix.dust, Materials.Apatite)
67+
},
68+
new FluidStack[] { Materials.Water.getFluid(1000) });
69+
70+
if (Mods.MagicBees.isModLoaded()) {
71+
GTRecipeHandler.removeRecipesByInputs(RecipeMaps.MIXER_RECIPES,
72+
new ItemStack[] {
73+
MetaItems.FERTILIZER.getStackForm(8),
74+
Mods.MagicBees.getItem("resource", 1, 2)
75+
},
76+
new FluidStack[] { Materials.Water.getFluid(1000) });
77+
}
5278
}
5379

5480
public static void materialCharcoal() {

src/main/java/com/github/gtexpert/gtbm/integration/gtfo/GTFOModule.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import net.minecraft.item.crafting.IRecipe;
44
import net.minecraftforge.event.RegistryEvent;
5+
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
56

67
import com.github.gtexpert.gtbm.api.ModValues;
78
import com.github.gtexpert.gtbm.api.modules.TModule;
89
import com.github.gtexpert.gtbm.api.util.Mods;
910
import com.github.gtexpert.gtbm.integration.GTBMIntegrationSubmodule;
11+
import com.github.gtexpert.gtbm.integration.gtfo.loaders.GTFOFarmingLoader;
1012
import com.github.gtexpert.gtbm.integration.gtfo.recipes.GTFOOverrideRecipe;
1113
import com.github.gtexpert.gtbm.module.Modules;
1214

@@ -18,6 +20,12 @@
1820
description = "Gregtech Food Option Integration Module")
1921
public class GTFOModule extends GTBMIntegrationSubmodule {
2022

23+
@Override
24+
public void postInit(FMLPostInitializationEvent event) {
25+
if (Mods.Forestry.isModLoaded())
26+
GTFOFarmingLoader.init();
27+
}
28+
2129
@Override
2230
public void registerRecipesLowest(RegistryEvent.Register<IRecipe> event) {
2331
GTFOOverrideRecipe.init();
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.github.gtexpert.gtbm.integration.gtfo.loaders;
2+
3+
import java.lang.reflect.Field;
4+
import java.util.List;
5+
6+
import net.minecraft.block.Block;
7+
import net.minecraft.item.ItemStack;
8+
9+
import forestry.api.core.ForestryAPI;
10+
import forestry.api.farming.IFarmRegistry;
11+
import forestry.farming.logic.farmables.FarmableSapling;
12+
13+
public class GTFOFarmingLoader {
14+
15+
@SuppressWarnings("unchecked")
16+
public static void init() {
17+
IFarmRegistry farmRegistry = ForestryAPI.farmRegistry;
18+
try {
19+
Class<?> metaBlocksClass = Class.forName("gregtechfoodoption.block.GTFOMetaBlocks");
20+
Field saplingsField = metaBlocksClass.getField("GTFO_SAPLINGS");
21+
List<Block> saplings = (List<Block>) saplingsField.get(null);
22+
for (Block sapling : saplings) {
23+
farmRegistry.registerFarmables("farmArboreal",
24+
new FarmableSapling(new ItemStack(sapling), new ItemStack[0]));
25+
}
26+
} catch (ReflectiveOperationException e) {
27+
com.github.gtexpert.gtbm.api.util.ModLog.logger.error("Failed to register GTFO saplings with Forestry farm",
28+
e);
29+
}
30+
}
31+
}

src/main/java/com/github/gtexpert/gtbm/mixins/GTBMMixinLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import java.util.Objects;
66
import java.util.stream.Collectors;
77

8-
import com.google.common.collect.ImmutableMap;
9-
108
import net.minecraftforge.fml.common.Loader;
119

10+
import com.google.common.collect.ImmutableMap;
11+
1212
import com.github.gtexpert.gtbm.api.ModValues;
1313
import com.github.gtexpert.gtbm.api.util.ModLog;
1414
import com.github.gtexpert.gtbm.api.util.Mods;

0 commit comments

Comments
 (0)