-
Notifications
You must be signed in to change notification settings - Fork 4
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 #5 from EnderProyects/feature/advanced_botany_infu
Feature/advanced botany
- Loading branch information
Showing
13 changed files
with
775 additions
and
99 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
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
558 changes: 464 additions & 94 deletions
558
src/main/java/ab/common/lib/register/RecipeListAB.java
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
package ab.utils; | ||
|
||
public class CraftingManager { | ||
|
||
public static void setupCrafting() { | ||
|
||
setupVanillaCrafting(); | ||
} | ||
|
||
private static void setupVanillaCrafting() { | ||
|
||
} | ||
} |
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,10 @@ | ||
package ab.utils; | ||
|
||
public interface IModHelper { | ||
|
||
public void preInit(); | ||
|
||
public void init(); | ||
|
||
public void postInit(); | ||
} |
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,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); | ||
} | ||
} | ||
} |
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,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(); | ||
} | ||
} |
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,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)); | ||
} | ||
} |
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,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); | ||
} | ||
} |
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,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; "; | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.