Skip to content

Commit

Permalink
Merge pull request #5 from EnderProyects/feature/advanced_botany_infu
Browse files Browse the repository at this point in the history
Feature/advanced botany
  • Loading branch information
Dream-Master authored Apr 8, 2023
2 parents 95f71be + bd32940 commit 5d2e822
Show file tree
Hide file tree
Showing 13 changed files with 775 additions and 99 deletions.
3 changes: 2 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
dependencies {
api('com.github.GTNewHorizons:Botania:1.9.2-GTNH:dev')
api('com.github.GTNewHorizons:Botanic-horizons:1.0.14-GTNH:dev')
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.254:dev')
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.42.36:dev')
api('com.github.GTNewHorizons:Baubles:1.0.1.14:dev')
compileOnly("com.github.GTNewHorizons:CodeChickenLib:1.1.5.3:dev")
compileOnly("com.github.GTNewHorizons:CodeChickenCore:1.1.5:dev")
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/ab/AdvancedBotany.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
modid = AdvancedBotany.modid,
name = "Advanced Botany",
version = AdvancedBotany.version,
dependencies = "required-after:Botania",
dependencies = AdvancedBotany.DEPENDENCIES,
guiFactory = "ab.client.core.handler.GuiABFactory")
public class AdvancedBotany {

public static final String modid = "AdvancedBotany";
public static final String version = "1.3.1.5";
public static final String version = "GRADLETOKEN_VERSION";
public static final String DEPENDENCIES = "required-after:Botania";

@Mod.Instance("AdvancedBotany")
public static AdvancedBotany instance;
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/ab/common/core/proxy/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,37 @@
import ab.common.lib.register.EntityListAB;
import ab.common.lib.register.FlowerRegister;
import ab.common.lib.register.ItemListAB;
import ab.common.lib.register.RecipeListAB;
import ab.common.minetweaker.MineTweakerConfig;
import ab.utils.CraftingManager;
import ab.utils.ModHelperManager;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;

@SuppressWarnings("unused")
public class CommonProxy {

public void preInit(FMLPreInitializationEvent event) {
BlockListAB.init();
ItemListAB.init();
AchievementRegister.init();
ModHelperManager.preInit();
EntityListAB.init();
FlowerRegister.init();
ConfigABHandler.loadConfig(event.getSuggestedConfigurationFile());
}

public void init(FMLInitializationEvent event) {
NetworkRegistry.INSTANCE.registerGuiHandler(AdvancedBotany.instance, new GuiHandler());
RecipeListAB.init();
NetworkHandler.registerPackets();
ModHelperManager.init();
}

public void postInit(FMLPostInitializationEvent event) {
ModHelperManager.postInit();
CraftingManager.setupCrafting();
ConfigABHandler.loadPostInit();
if (Loader.isModLoaded("MineTweaker3")) MineTweakerConfig.registerMT();
}
Expand Down
558 changes: 464 additions & 94 deletions src/main/java/ab/common/lib/register/RecipeListAB.java

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/main/java/ab/utils/CraftingManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ab.utils;

public class CraftingManager {

public static void setupCrafting() {

setupVanillaCrafting();
}

private static void setupVanillaCrafting() {

}
}
10 changes: 10 additions & 0 deletions src/main/java/ab/utils/IModHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ab.utils;

public interface IModHelper {

public void preInit();

public void init();

public void postInit();
}
22 changes: 22 additions & 0 deletions src/main/java/ab/utils/LocalizationManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ab.utils;

import net.minecraft.util.StatCollector;

public class LocalizationManager {

public static String getLocalizedString(String key) {
if (StatCollector.canTranslate(key)) {
return StatCollector.translateToLocal(key);
} else {
return StatCollector.translateToFallback(key);
}
}

public static String getLocalizedString(String key, Object... objects) {
if (StatCollector.canTranslate(key)) {
return String.format(StatCollector.translateToLocal(key), objects);
} else {
return String.format(StatCollector.translateToFallback(key), objects);
}
}
}
27 changes: 27 additions & 0 deletions src/main/java/ab/utils/ModHelperManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package ab.utils;

import ab.common.lib.register.RecipeListAB;

public class ModHelperManager {

private static IModHelper helper;

public static void preInit() {
setupHelpers();

helper.preInit();
}

public static void init() {
// helper.init();
}

public static void postInit() {
helper.postInit();
}

private static void setupHelpers() {

helper = new RecipeListAB();
}
}
44 changes: 44 additions & 0 deletions src/main/java/ab/utils/OreDict.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package ab.utils;

import java.util.Arrays;
import java.util.List;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

import vazkii.botania.common.lib.LibOreDict;

public class OreDict {

public static final String[] FLOWER_INGREDIENT = new String[] { "flowerIngredientWhite", "flowerIngredientOrange",
"flowerIngredientMagenta", "flowerIngredientLightBlue", "flowerIngredientYellow", "flowerIngredientLime",
"flowerIngredientPink", "flowerIngredientGray", "flowerIngredientLightGray", "flowerIngredientCyan",
"flowerIngredientPurple", "flowerIngredientBlue", "flowerIngredientBrown", "flowerIngredientGreen",
"flowerIngredientRed", "flowerIngredientBlack" };

public static final String[] FLOWER_VANILLA = new String[] { "flowerWhite", "flowerOrange", "flowerMagenta",
"flowerLightBlue", "flowerYellow", "flowerLime", "flowerPink", "flowerGray", "flowerLightGray",
"flowerCyan", "flowerPurple", "flowerBlue", "flowerBrown", "flowerGreen", "flowerRed", "flowerBlack" };

public static final String GAIA_SPIRIT = LibOreDict.LIFE_ESSENCE;

public static final String MUSHROOM = "listMagicMushroom";

public static final String FLOWER_NONMAGICAL = "flowerNonmagical";

// GT Material references
public static final String MANA_STEEL_PLATE = "plateManasteel";
public static final String DENSE_MANA_STEEL_PLATE = "plateDenseManasteel";
public static final String TERRA_STEEL_PLATE = "plateTerrasteel";
public static final String DENSE_TERRA_STEEL_PLATE = "plateDenseTerrasteel";
public static final String ELEMENTIUM_PLATE = "plateElvenElementium";
public static final String DENSE_ELEMENTIUM_STEEL_PLATE = "plateDenseElvenElementium";

public static final ItemStack preference(String... oredictKeys) {
for (String key : oredictKeys) {
List<ItemStack> ores = OreDictionary.getOres(key);
if (ores != null && ores.size() > 0) return ores.get(0);
}
throw new IllegalArgumentException("Can't find any oreDictionary entry among " + Arrays.toString(oredictKeys));
}
}
161 changes: 161 additions & 0 deletions src/main/java/ab/utils/ResearchBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
package ab.utils;

import java.util.LinkedList;

import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;

import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.CrucibleRecipe;
import thaumcraft.api.crafting.ShapedArcaneRecipe;
import thaumcraft.api.crafting.ShapelessArcaneRecipe;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ResearchItem;
import thaumcraft.api.research.ResearchPage;
import ab.AdvancedBotany;

public class ResearchBuilder {

public static final String category = AdvancedBotany.modid;
public static final String prefix = "AB";

public final String key;
public int row = 0;
public int col = 0;
public int researchDifficulty = 1;
public int warp = 0;
public boolean mainline = false;
public String[] dependencies = new String[0];
public String[] hiddenDependencies = new String[0];
public AspectList researchAspects;
public LinkedList<ResearchPage> content = new LinkedList<>();
public ResourceLocation researchIcon = new ResourceLocation("botania", "textures/gui/categories/forgotten.png");
public ItemStack researchItemIcon = null;

public ResearchBuilder(String key) {
this.key = prefix + key;
}

public ResearchBuilder setResearchAspects(Aspect... aspects) {
AspectList list = new AspectList();
for (Aspect aspect : aspects) {
list.add(aspect, 1);
}
this.researchAspects = list;
return this;
}

// goes in units of whole tiles - have >= 2 difference to see lines
public ResearchBuilder setBookLocation(int x, int y) {
this.row = y;
this.col = x;
return this;
}

public ResearchBuilder setDifficulty(int difficulty) {
this.researchDifficulty = difficulty;
return this;
}

public ResearchBuilder setResearchIconItem(String mod, String filename) {
this.researchIcon = new ResourceLocation(mod, "textures/items/" + filename);
return this;
}

public ResearchBuilder setResearchIconBlock(String mod, String filename) {
this.researchIcon = new ResourceLocation(mod, "textures/blocks/" + filename);
return this;
}

public ResearchBuilder setResearchIconItemStack(ItemStack render) {
this.researchItemIcon = render;
return this;
}

public ResearchBuilder addSingleTextPage() {
content.add(new ResearchPage(this.key, category + "." + key + ".body"));
return this;
}

public ResearchBuilder addTextPages(int i18n_start, int count) {
for (int i = i18n_start; i < i18n_start + count; i++) {
content.add(new ResearchPage(this.key, category + "." + key + ".body_" + i));
}
return this;
}

public ResearchBuilder addCraftingRecipe(ItemStack out, AspectList aspects, Object... craftingRecipe) {
ShapedArcaneRecipe recipe = ThaumcraftApi.addArcaneCraftingRecipe(key, out, aspects, craftingRecipe);
content.add(new ResearchPage(recipe));
return this;
}

public ResearchBuilder addShapelessCraftingRecipe(ItemStack out, AspectList aspects, Object... craftingRecipe) {
ShapelessArcaneRecipe recipe = ThaumcraftApi
.addShapelessArcaneCraftingRecipe(key, out, aspects, craftingRecipe);
content.add(new ResearchPage(recipe));
return this;
}

public ResearchBuilder addCrucibleRecipe(AspectList aspects, ItemStack out, ItemStack in) {
CrucibleRecipe recipe = ThaumcraftApi.addCrucibleRecipe(key, out, in, aspects);
content.add(new ResearchPage(recipe));
return this;
}

public ResearchBuilder setWarp(int warp) {
this.warp = warp;
return this;
}

public ResearchBuilder setMainlineResearch() {
this.mainline = true;
return this;
}

public ResearchBuilder setDependencies(String... dependencies) {
this.dependencies = dependencies;
for (int i = 0; i < this.dependencies.length; i++) {
this.dependencies[i] = prefix + this.dependencies[i];
}
return this;
}

public ResearchBuilder setExternalDependencies(String... dependencies) {
this.hiddenDependencies = dependencies;
return this;
}

public ResearchBuilder apply(WithResearchBuilder lambda) {
lambda.apply(this);
return this;
}

public void commit() {
ResearchItem research;
if (researchItemIcon != null) {
research = new ResearchItem(key, category, researchAspects, col, row, researchDifficulty, researchItemIcon);
} else {
research = new ResearchItem(key, category, researchAspects, col, row, researchDifficulty, researchIcon);
}
research.setPages(content.toArray(new ResearchPage[0]));
research.parents = dependencies;
research.parentsHidden = hiddenDependencies;
research.setConcealed();
if (mainline) {
research.setSpecial();
}

ResearchCategories.addResearch(research);
if (warp > 0) {
ThaumcraftApi.addWarpToResearch(key, warp);
}
}

public interface WithResearchBuilder {

void apply(ResearchBuilder builder);
}
}
9 changes: 9 additions & 0 deletions src/main/java/ab/utils/VersionInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ab.utils;

public class VersionInfo {

public static final String ModID = "GRADLETOKEN_MODID";
public static final String ModName = "GRADLETOKEN_MODNAME";
public static final String Version = "GRADLETOKEN_VERSION";
public static final String Depends = "required-after:Thaumcraft; ";
}
13 changes: 13 additions & 0 deletions src/main/resources/assets/ab/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ ab.sphereNavigation.founded=Found
abmisc.fateBoard.info0=The opportunity to play on this board, he dreamed of
abmisc.fateBoard.info1=every Elf, hoping to get a valuable prize...

//THAUMCRAFT

tc.research_category.AdvancedBotany=Advanced Botany
tc.research_category.AB_botania=Advanced Botany
tc.research_name.TerraHoe=Terra Hoe
tc.research_name.AquaSword=Blade of sea
tc.research_name.ManaCharger=Mana Charger
tc.research_name.MithrillSword=Blade of Space
tc.research_name.Forge=Forge of Nidavellir
tc.research_name.Destroyer=Material Destroyer



//ACHIEVEMENT

achievement.ab:fateBoard=Playing with fate
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5d2e822

Please sign in to comment.