mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-27 15:33:08 +00:00
Make the lexica botanica recipe-change proof
(cherry picked from commit 672394cc6d12b7b8edca922468d1f96284ff5088)
This commit is contained in:
1 parent
0ef2be2398
commit
3527358443
16 files changed
+63
-10
No files matched your search
@@ -43,6 +43,8 @@ public final class ConfigHandler {
|
||||
|
||||
public static boolean useAdaptativeConfig = true;
|
||||
|
||||
public static boolean enableDefaultRecipes = false;
|
||||
|
||||
public static boolean useShaders = true;
|
||||
public static boolean lexiconRotatingItems = true;
|
||||
public static boolean lexiconJustifiedText = false;
|
||||
@@ -281,6 +283,9 @@ public final class ConfigHandler {
|
||||
desc = "The quantity of Botania mushrooms to generate underground, in the world, defaults to 40, the lower the number the less patches generate.";
|
||||
mushroomQuantity = loadPropInt("worldgen.mushroom.quantity", desc, mushroomQuantity);
|
||||
|
||||
desc = "Enables all built-in recipes. This can be false for expert modpacks that wish to supply their own.";
|
||||
enableDefaultRecipes = loadPropBool("recipes.enabled", desc, enableDefaultRecipes);
|
||||
|
||||
potionIDSoulCross = loadPropPotionId(LibPotionNames.SOUL_CROSS, potionIDSoulCross);
|
||||
potionIDFeatherfeet = loadPropPotionId(LibPotionNames.FEATHER_FEET, potionIDFeatherfeet);
|
||||
potionIDEmptiness = loadPropPotionId(LibPotionNames.EMPTINESS, potionIDEmptiness);
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.common.brew.ModBrews;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class ModBrewRecipes {
|
||||
@@ -46,6 +47,8 @@ public class ModBrewRecipes {
|
||||
public static RecipeBrew warpWardBrew;
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
speedBrew = BotaniaAPI.registerBrewRecipe(ModBrews.speed, new ItemStack(Items.nether_wart), new ItemStack(Items.sugar), new ItemStack(Items.redstone));
|
||||
strengthBrew = BotaniaAPI.registerBrewRecipe(ModBrews.strength, new ItemStack(Items.nether_wart), new ItemStack(Items.blaze_powder), new ItemStack(Items.glowstone_dust));
|
||||
hasteBrew = BotaniaAPI.registerBrewRecipe(ModBrews.haste, new ItemStack(Items.nether_wart), new ItemStack(Items.sugar), new ItemStack(Items.gold_nugget));
|
||||
|
||||
@@ -320,6 +320,8 @@ public final class ModCraftingRecipes {
|
||||
public static IRecipe recipeEndPortal;
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
int recipeListSize = CraftingManager.getInstance().getRecipeList().size();
|
||||
|
||||
// Lexicon Recipe
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
|
||||
@@ -22,6 +23,8 @@ public class ModElvenTradeRecipes {
|
||||
public static RecipeElvenTrade alfglassRecipe;
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
dreamwoodRecipe = BotaniaAPI.registerElvenTradeRecipe(new ItemStack(ModBlocks.dreamwood), LibOreDict.LIVING_WOOD);
|
||||
|
||||
elementiumRecipes = new ArrayList();
|
||||
|
||||
@@ -53,6 +53,8 @@ public final class ModManaAlchemyRecipes {
|
||||
public static List<RecipeManaInfusion> flowersRecipes;
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
leatherRecipe = BotaniaAPI.registerManaAlchemyRecipe(new ItemStack(Items.leather), new ItemStack(Items.rotten_flesh), 600);
|
||||
|
||||
woodRecipes = new ArrayList();
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
|
||||
public class ModManaConjurationRecipes {
|
||||
|
||||
@@ -34,6 +35,8 @@ public class ModManaConjurationRecipes {
|
||||
public static RecipeManaInfusion grassRecipe;
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
redstoneRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Items.redstone, 2), new ItemStack(Items.redstone), 5000);
|
||||
glowstoneRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Items.glowstone_dust, 2), new ItemStack(Items.glowstone_dust), 5000);
|
||||
quartzRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Items.quartz, 2), new ItemStack(Items.quartz), 2500);
|
||||
|
||||
@@ -21,6 +21,7 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public final class ModManaInfusionRecipes {
|
||||
@@ -43,6 +44,8 @@ public final class ModManaInfusionRecipes {
|
||||
public static RecipeManaInfusion sugarCaneRecipe;
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
manasteelRecipes = new ArrayList();
|
||||
manasteelRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 0), "ingotIron", 3000));
|
||||
manasteelRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModBlocks.storage, 1, 0), new ItemStack(Blocks.iron_block), 27000));
|
||||
|
||||
@@ -77,6 +77,8 @@ public final class ModPetalRecipes {
|
||||
public static RecipePetals solegnoliaRecipe;
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
pureDaisyRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), white, white, white, white);
|
||||
manastarRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_MANASTAR), lightBlue, green, red, cyan);
|
||||
|
||||
|
||||
@@ -13,11 +13,14 @@ package vazkii.botania.common.crafting;
|
||||
import net.minecraft.init.Blocks;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
|
||||
public final class ModPureDaisyRecipes {
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
BotaniaAPI.registerPureDaisyRecipe("stone", ModBlocks.livingrock, 0);
|
||||
BotaniaAPI.registerPureDaisyRecipe("logWood", ModBlocks.livingwood, 0);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.crafting.recipe.HeadRecipe;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
@@ -45,6 +46,8 @@ public final class ModRuneRecipes {
|
||||
public static RecipeRuneAltar recipeHead;
|
||||
|
||||
public static void init() {
|
||||
if (!ConfigHandler.enableDefaultRecipes) return;
|
||||
|
||||
final int costTier1 = 5200;
|
||||
final int costTier2 = 8000;
|
||||
final int costTier3 = 12000;
|
||||
|
||||
@@ -1162,8 +1162,11 @@ public final class LexiconData {
|
||||
List<LexiconPage> pages = new ArrayList();
|
||||
pages.add(new PageText("0"));
|
||||
pages.add(new PageText("1"));
|
||||
for (int i = 0; i < 32; i++)
|
||||
pages.add(new PageCraftingRecipe("" + (i + 2), ModCraftingRecipes.recipesCosmeticItems.get(i)));
|
||||
if (ModCraftingRecipes.recipesCosmeticItems != null) {
|
||||
for (int i = 0; i < 32; i++) {
|
||||
pages.add(new PageCraftingRecipe("" + (i + 2), ModCraftingRecipes.recipesCosmeticItems.get(i)));
|
||||
}
|
||||
}
|
||||
cosmeticBaubles.setPriority().setLexiconPages(pages.toArray(new LexiconPage[pages.size()]));
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
|
||||
public PageCraftingRecipe(String unlocalizedName, List<IRecipe> recipes) {
|
||||
super(unlocalizedName);
|
||||
this.recipes = recipes;
|
||||
this.recipes = filterRecipes(recipes);
|
||||
}
|
||||
|
||||
public PageCraftingRecipe(String unlocalizedName, IRecipe recipe) {
|
||||
@@ -59,7 +59,8 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
@Override
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
for(IRecipe recipe : recipes)
|
||||
LexiconRecipeMappings.map(recipe.getRecipeOutput(), entry, index);
|
||||
if (recipe != null)
|
||||
LexiconRecipeMappings.map(recipe.getRecipeOutput(), entry, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +68,9 @@ public class PageCraftingRecipe extends PageRecipe {
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
oreDictRecipe = shapelessRecipe = false;
|
||||
|
||||
if (recipes.size() == 0) return;
|
||||
IRecipe recipe = recipes.get(recipeAt);
|
||||
|
||||
renderCraftingRecipe(gui, recipe);
|
||||
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PageElvenRecipe extends PageRecipe {
|
||||
|
||||
public PageElvenRecipe(String unlocalizedName, List<RecipeElvenTrade> recipes) {
|
||||
super(unlocalizedName);
|
||||
this.recipes = recipes;
|
||||
this.recipes = filterRecipes(recipes);
|
||||
}
|
||||
|
||||
public PageElvenRecipe(String unlocalizedName, RecipeElvenTrade recipe) {
|
||||
@@ -45,13 +45,16 @@ public class PageElvenRecipe extends PageRecipe {
|
||||
@Override
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
for(RecipeElvenTrade recipe : recipes)
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
if (recipe != null)
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
if (recipes.size() == 0) return;
|
||||
RecipeElvenTrade recipe = recipes.get(recipeAt);
|
||||
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
render.bindTexture(elvenTradeOverlay);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PageManaInfusionRecipe extends PageRecipe {
|
||||
|
||||
public PageManaInfusionRecipe(String unlocalizedName, List<RecipeManaInfusion> recipes) {
|
||||
super(unlocalizedName);
|
||||
this.recipes = recipes;
|
||||
this.recipes = filterRecipes(recipes);
|
||||
}
|
||||
|
||||
public PageManaInfusionRecipe(String unlocalizedName, RecipeManaInfusion recipe) {
|
||||
@@ -60,13 +60,16 @@ public class PageManaInfusionRecipe extends PageRecipe {
|
||||
@Override
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
for(RecipeManaInfusion recipe : recipes)
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
if (recipe != null)
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
if (recipes.size() == 0) return;
|
||||
RecipeManaInfusion recipe = recipes.get(recipeAt);
|
||||
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
|
||||
|
||||
public PagePetalRecipe(String unlocalizedName, List<T> recipes) {
|
||||
super(unlocalizedName);
|
||||
this.recipes = recipes;
|
||||
this.recipes = filterRecipes(recipes);
|
||||
}
|
||||
|
||||
public PagePetalRecipe(String unlocalizedName, T recipe) {
|
||||
@@ -56,13 +56,16 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
|
||||
@Override
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
for(T recipe : recipes)
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
if (recipe != null)
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
if (recipes.size() == 0) return;
|
||||
T recipe = recipes.get(recipeAt);
|
||||
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
|
||||
renderItemAtGridPos(gui, 3, 0, recipe.getOutput(), false);
|
||||
|
||||
@@ -181,4 +181,13 @@ public class PageRecipe extends LexiconPage {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
public static <T> List<T> filterRecipes(List<T> list) {
|
||||
if (list == null) return new ArrayList<T>();
|
||||
ArrayList<T> filtered = new ArrayList<T>();
|
||||
for (T entry: list) {
|
||||
if (entry != null) filtered.add(entry);
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user