mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 00:37:57 +00:00
Added the Elven Trade page.
This commit is contained in:
1 parent
8b1d9aba69
commit
2bef432ee0
6 files changed
+121
-10
No files matched your search
@@ -105,15 +105,8 @@ public class GuiLexicon extends GuiScreen {
|
||||
x += l / 2;
|
||||
fontOff = 2;
|
||||
}
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(0F, 0F, 0F, 0.25F);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(x + l / 2 + 4, y, 54, 180, 6, 11);
|
||||
if(drawLeft)
|
||||
drawTexturedModalRect(x - l / 2 - 9, y, 61, 180, 6, 11);
|
||||
for(int i = 0; i < l + 6; i++)
|
||||
drawTexturedModalRect(x - l / 2 - 3 + i, y, 60, 180, 1, 11);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x + l / 2 + 3, y - 1, 54, 180, 6, 11);
|
||||
@@ -121,7 +114,6 @@ public class GuiLexicon extends GuiScreen {
|
||||
drawTexturedModalRect(x - l / 2 - 9, y - 1, 61, 180, 6, 11);
|
||||
for(int i = 0; i < l + 6; i++)
|
||||
drawTexturedModalRect(x - l / 2 - 3 + i, y - 1, 60, 180, 1, 11);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
font.drawString(s, x - l / 2 + fontOff, y, 0x111111, false);
|
||||
font.setUnicodeFlag(unicode);
|
||||
|
||||
@@ -32,6 +32,7 @@ public final class LibResources {
|
||||
public static final String GUI_MANA_INFUSION_OVERLAY = PREFIX_GUI + "manaInfusionOverlay.png";
|
||||
public static final String GUI_PETAL_OVERLAY = PREFIX_GUI + "petalOverlay.png";
|
||||
public static final String GUI_TERRASTEEL_OVERLAY = PREFIX_GUI + "terrasteelOverlay.png";
|
||||
public static final String GUI_ELVEN_TRADE_OVERLAY = PREFIX_GUI + "elvenTradeOverlay.png";
|
||||
|
||||
public static final String ENTRY_FLOWERS = PREFIX_ENTRIES + "flowers.png";
|
||||
public static final String ENTRY_APOTHECARY = PREFIX_ENTRIES + "apothecary.png";
|
||||
|
||||
@@ -20,11 +20,13 @@ import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.crafting.ModCrafingRecipes;
|
||||
import vazkii.botania.common.crafting.ModElvenTradeRecipes;
|
||||
import vazkii.botania.common.crafting.ModManaAlchemyRecipes;
|
||||
import vazkii.botania.common.crafting.ModManaInfusionRecipes;
|
||||
import vazkii.botania.common.crafting.ModPetalRecipes;
|
||||
import vazkii.botania.common.crafting.ModRuneRecipes;
|
||||
import vazkii.botania.common.lexicon.page.PageCraftingRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PageElvenRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PageImage;
|
||||
import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe;
|
||||
import vazkii.botania.common.lexicon.page.PagePetalRecipe;
|
||||
@@ -462,7 +464,7 @@ public final class LexiconData {
|
||||
elvenMessage.setPriority().setLexiconPages(new PageImage("0", LibResources.ENTRY_ELVEN_GARDE), new PageText("1"));
|
||||
|
||||
elvenResources = new ALexiconEntry(LibLexicon.ALF_RESOURCES, categoryAlfhomancy);
|
||||
elvenResources.setPriority().setLexiconPages(new PageText("0"));
|
||||
elvenResources.setPriority().setLexiconPages(new PageText("0"), new PageElvenRecipe("1", ModElvenTradeRecipes.elementiumRecipe));
|
||||
|
||||
// MISCLENAEOUS ENTRIES
|
||||
unstableBlocks = new BLexiconEntry(LibLexicon.MISC_UNSTABLE_BLOCKS, categoryMisc);
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package vazkii.botania.common.lexicon.page;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.BlockAlfPortal;
|
||||
import vazkii.botania.common.crafting.ModElvenTradeRecipes;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PageElvenRecipe extends PageRecipe {
|
||||
|
||||
private static final ResourceLocation elvenTradeOverlay = new ResourceLocation(LibResources.GUI_ELVEN_TRADE_OVERLAY);
|
||||
|
||||
List<RecipeElvenTrade> recipes;
|
||||
int ticksElapsed = 0;
|
||||
int recipeAt = 0;
|
||||
|
||||
public PageElvenRecipe(String unlocalizedName, List<RecipeElvenTrade> recipes) {
|
||||
super(unlocalizedName);
|
||||
this.recipes = recipes;
|
||||
}
|
||||
|
||||
public PageElvenRecipe(String unlocalizedName, RecipeElvenTrade recipe) {
|
||||
this(unlocalizedName, Arrays.asList(recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
for(RecipeElvenTrade recipe : recipes)
|
||||
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
|
||||
RecipeElvenTrade recipe = recipes.get(recipeAt);
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
render.bindTexture(elvenTradeOverlay);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
renderItemAtGridPos(gui, 3, 1, recipe.getOutput(), false);
|
||||
|
||||
List<Object> inputs = recipe.getInputs();
|
||||
int i = 0;
|
||||
for(Object obj : inputs) {
|
||||
Object input = obj;
|
||||
if(input instanceof String)
|
||||
input = OreDictionary.getOres((String) input).get(0);
|
||||
|
||||
renderItemAtInputPos(gui, i, (ItemStack) input);
|
||||
i++;
|
||||
}
|
||||
|
||||
IIcon portalIcon = BlockAlfPortal.portalTex;
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
RenderItem.getInstance().renderIcon(gui.getLeft() + 22, gui.getTop() + 36, portalIcon, 48, 48);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderItemAtInputPos(IGuiLexiconEntry gui, int x, ItemStack stack) {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return;
|
||||
stack = stack.copy();
|
||||
|
||||
if(stack.getItemDamage() == Short.MAX_VALUE)
|
||||
stack.setItemDamage(0);
|
||||
|
||||
int xPos = gui.getLeft() + x * 20 + 45;
|
||||
int yPos = gui.getTop() + 14;
|
||||
ItemStack stack1 = stack.copy();
|
||||
if(stack1.getItemDamage() == -1)
|
||||
stack1.setItemDamage(0);
|
||||
|
||||
renderItem(gui, xPos, yPos, stack1, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen() {
|
||||
if(ticksElapsed % 20 == 0) {
|
||||
recipeAt++;
|
||||
|
||||
if(recipeAt == recipes.size())
|
||||
recipeAt = 0;
|
||||
}
|
||||
++ticksElapsed;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1078,6 +1078,7 @@ botania.page.elfMessage1=WIP
|
||||
# -- THE RESOURCES OF ALFHEIM
|
||||
botania.entry.elfResources=The Resources of Alfheim
|
||||
botania.page.elfResources0=WIP
|
||||
botania.page.elfResources1=Trading for &1Elementium&0
|
||||
|
||||
# - MISCLANEOUS
|
||||
# -- UNSTABLE CUBE
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
Reference in new issue
Block a user