mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-08 12:34:53 +00:00
21 files changed
+136
-31
No files matched your search
@@ -15,11 +15,13 @@ import java.awt.Color;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -51,6 +53,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
|
||||
ModelAltar model = new ModelAltar();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
RenderBlocks renderBlocks = new RenderBlocks();
|
||||
public static int forceMeta = -1;
|
||||
|
||||
@Override
|
||||
@@ -84,6 +87,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
else break;
|
||||
|
||||
if(petals > 0) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
final float modifier = 6F;
|
||||
final float rotationModifier = 0.25F;
|
||||
final float radiusBase = 1.2F;
|
||||
@@ -120,17 +124,26 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
ItemStack stack = altar.getStackInSlot(i);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
IIcon icon = stack.getItem().getIcon(stack, 0);
|
||||
if(icon != null) {
|
||||
Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
minecraft.renderEngine.bindTexture(stack.getItem() instanceof ItemBlock ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
|
||||
|
||||
if(stack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glTranslatef(1F, 1.1F, 0F);
|
||||
renderBlocks.renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1F);
|
||||
GL11.glTranslatef(-1F, -1.1F, 0F);
|
||||
GL11.glScalef(2F, 2F, 2F);
|
||||
} else {
|
||||
IIcon icon = stack.getItem().getIcon(stack, 0);
|
||||
if (icon != null) {
|
||||
Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package vazkii.botania.common;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import vazkii.botania.api.recipe.IFlowerComponent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class CustomBotaniaAPI {
|
||||
public static Map<Item, IFlowerComponent> extraFlowerComponents = new HashMap<Item, IFlowerComponent>();
|
||||
}
|
||||
@@ -41,6 +41,7 @@ import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.CustomBotaniaAPI;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class TileAltar extends TileSimpleInventory implements ISidedInventory, IPetalApothecary {
|
||||
@@ -94,7 +95,7 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I
|
||||
|
||||
boolean didChange = false;
|
||||
|
||||
if(stack.getItem() instanceof IFlowerComponent && ((IFlowerComponent) stack.getItem()).canFit(stack, this)) {
|
||||
if(canGoInAltar(stack, this)) {
|
||||
if(getStackInSlot(getSizeInventory() - 1) != null)
|
||||
return false;
|
||||
|
||||
@@ -145,6 +146,21 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I
|
||||
return didChange;
|
||||
}
|
||||
|
||||
private IFlowerComponent getFlowerComponent(ItemStack stack) {
|
||||
IFlowerComponent component = CustomBotaniaAPI.extraFlowerComponents.get(stack.getItem());
|
||||
if (component == null) {
|
||||
if (stack.getItem() instanceof IFlowerComponent) {
|
||||
component = (IFlowerComponent) stack.getItem();
|
||||
}
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
||||
private boolean canGoInAltar(ItemStack stack, TileAltar reference) {
|
||||
IFlowerComponent component = getFlowerComponent(stack);
|
||||
return component != null && component.canFit(stack, reference);
|
||||
}
|
||||
|
||||
public void saveLastRecipe() {
|
||||
lastRecipe = new ArrayList();
|
||||
for(int i = 0; i < getSizeInventory(); i++) {
|
||||
@@ -235,7 +251,7 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I
|
||||
break;
|
||||
|
||||
if(Math.random() >= 0.97) {
|
||||
Color color = new Color(((IFlowerComponent) stackAt.getItem()).getParticleColor(stackAt));
|
||||
Color color = new Color(getFlowerComponent(stackAt).getParticleColor(stackAt));
|
||||
float red = color.getRed() / 255F;
|
||||
float green = color.getGreen() / 255F;
|
||||
float blue = color.getBlue() / 255F;
|
||||
|
||||
@@ -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;
|
||||
@@ -92,7 +94,7 @@ public final class ConfigHandler {
|
||||
public static int harvestLevelWeight = 2;
|
||||
public static int harvestLevelBore = 3;
|
||||
|
||||
public static int flowerQuantity = 2;
|
||||
public static int flowerQuantity = 0;
|
||||
public static int flowerDensity = 2;
|
||||
public static int flowerPatchSize = 6;
|
||||
public static int flowerPatchChance = 16;
|
||||
@@ -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);
|
||||
|
||||
@@ -121,10 +121,10 @@ public class CommonProxy {
|
||||
|
||||
ChestGenHandler.init();
|
||||
|
||||
LexiconData.init();
|
||||
|
||||
if(Botania.gardenOfGlassLoaded)
|
||||
new WorldTypeSkyblock();
|
||||
|
||||
LexiconData.preInit();
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
@@ -147,6 +147,8 @@ public class CommonProxy {
|
||||
|
||||
if(Botania.bcTriggersLoaded)
|
||||
new StatementAPIPlugin();
|
||||
|
||||
LexiconData.init();
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -295,7 +295,7 @@ public final class LexiconData {
|
||||
public static LexiconEntry bcIntegration;
|
||||
public static LexiconEntry banners;
|
||||
|
||||
public static void init() {
|
||||
public static void preInit() {
|
||||
BotaniaAPI.addCategory(BotaniaAPI.categoryBasics = new BLexiconCategory(LibLexicon.CATEGORY_BASICS, 9));
|
||||
BotaniaAPI.addCategory(BotaniaAPI.categoryMana = new BLexiconCategory(LibLexicon.CATEGORY_MANA, 5));
|
||||
BotaniaAPI.addCategory(
|
||||
@@ -308,7 +308,9 @@ public final class LexiconData {
|
||||
BotaniaAPI.addCategory(BotaniaAPI.categoryEnder = new BLexiconCategory(LibLexicon.CATEGORY_ENDER, 5));
|
||||
BotaniaAPI.addCategory(BotaniaAPI.categoryAlfhomancy = new BLexiconCategory(LibLexicon.CATEGORY_ALFHOMANCY, 5));
|
||||
BotaniaAPI.addCategory(BotaniaAPI.categoryMisc = new BLexiconCategory(LibLexicon.CATEGORY_MISC, 0));
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
LexiconCategory categoryBasics = BotaniaAPI.categoryBasics;
|
||||
LexiconCategory categoryMana = BotaniaAPI.categoryMana;
|
||||
LexiconCategory categoryGenerationFlowers = BotaniaAPI.categoryGenerationFlowers;
|
||||
@@ -1162,8 +1164,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()]));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,9 @@ public class PageBrew extends PageRecipe implements ITwoNamedPage {
|
||||
@Override
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
list.add(recipe.getOutput(new ItemStack(ModItems.vial)));
|
||||
if (recipe != null) {
|
||||
list.add(recipe.getOutput(new ItemStack(ModItems.vial)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -43,10 +43,11 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
|
||||
List<T> recipes;
|
||||
int ticksElapsed = 0;
|
||||
int recipeAt = 0;
|
||||
int oredictCounter = 0;
|
||||
|
||||
public PagePetalRecipe(String unlocalizedName, List<T> recipes) {
|
||||
super(unlocalizedName);
|
||||
this.recipes = recipes;
|
||||
this.recipes = filterRecipes(recipes);
|
||||
}
|
||||
|
||||
public PagePetalRecipe(String unlocalizedName, T recipe) {
|
||||
@@ -56,13 +57,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);
|
||||
@@ -74,8 +78,10 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
|
||||
|
||||
for(Object obj : inputs) {
|
||||
Object input = obj;
|
||||
if(input instanceof String)
|
||||
input = OreDictionary.getOres((String) input).get(0);
|
||||
if(input instanceof String) {
|
||||
List<ItemStack> ores = OreDictionary.getOres((String) input);
|
||||
input = ores.get(oredictCounter % ores.size());
|
||||
}
|
||||
|
||||
renderItemAtAngle(gui, currentDegree, (ItemStack) input);
|
||||
|
||||
@@ -124,8 +130,10 @@ public class PagePetalRecipe<T extends RecipePetals> extends PageRecipe {
|
||||
if(ticksElapsed % 20 == 0) {
|
||||
recipeAt++;
|
||||
|
||||
if(recipeAt == recipes.size())
|
||||
if(recipeAt == recipes.size()) {
|
||||
recipeAt = 0;
|
||||
oredictCounter++;
|
||||
}
|
||||
}
|
||||
++ticksElapsed;
|
||||
}
|
||||
|
||||
@@ -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