Created the needed pages in the botania guide

This commit is contained in:
SoundLogic committed 2014-08-23 14:35:39 -05:00
1 parent 8e7b821708
commit c24571006a
6 files changed
+293 -2

No files matched your search

@@ -33,6 +33,7 @@ public final class LibResources {
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 GUI_SHEDDING_OVERLAY = PREFIX_GUI + "sheddingOverlay.png";
public static final String ENTRY_FLOWERS = PREFIX_ENTRIES + "flowers.png";
public static final String ENTRY_APOTHECARY = PREFIX_ENTRIES + "apothecary.png";
@@ -11,6 +11,7 @@
*/
package vazkii.botania.common.lexicon;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconCategory;
@@ -29,10 +30,12 @@ import vazkii.botania.common.crafting.ModRuneRecipes;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.page.PageCraftingRecipe;
import vazkii.botania.common.lexicon.page.PageElvenRecipe;
import vazkii.botania.common.lexicon.page.PageEntity;
import vazkii.botania.common.lexicon.page.PageImage;
import vazkii.botania.common.lexicon.page.PageManaInfusionRecipe;
import vazkii.botania.common.lexicon.page.PagePetalRecipe;
import vazkii.botania.common.lexicon.page.PageRuneRecipe;
import vazkii.botania.common.lexicon.page.PageShedding;
import vazkii.botania.common.lexicon.page.PageTerrasteel;
import vazkii.botania.common.lexicon.page.PageText;
import vazkii.botania.common.lib.LibLexicon;
@@ -604,7 +607,11 @@ public final class LexiconData {
prismarine.setLexiconPages(new PageText("0"), new PageText("1"), new PageManaInfusionRecipe("2", ModManaAlchemyRecipes.prismarineRecipe), new PageCraftingRecipe("3", ModCrafingRecipes.recipePrismarine), new PageCraftingRecipe("4", ModCrafingRecipes.recipePrismarineBrick), new PageCraftingRecipe("5", ModCrafingRecipes.recipeDarkPrismarine), new PageCraftingRecipe("6", ModCrafingRecipes.recipeSeaLamp));
shedding = new BLexiconEntry(LibLexicon.MISC_SHEDDING, categoryMisc);
shedding.setLexiconPages(new PageText("0"));
shedding.setLexiconPages(new PageText("0"),
new PageShedding("1", "Chicken", 20, new ItemStack(Items.feather)),
new PageShedding("2", "Skeleton", 40, new ItemStack(Items.bone)),
new PageShedding("3", "Ghast", 30, new ItemStack(Items.ghast_tear)),
new PageShedding("4", "Villager", 40, new ItemStack(Items.emerald)));
tinyPotato = new BLexiconEntry(LibLexicon.MISC_TINY_POTATO, categoryMisc);
tinyPotato.setLexiconPages(new PageText("0"), new PageManaInfusionRecipe("1", ModManaInfusionRecipes.tinyPotatoRecipe));
@@ -0,0 +1,136 @@
package vazkii.botania.common.lexicon.page;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
import vazkii.botania.client.gui.lexicon.GuiLexiconEntry;
import net.minecraft.world.World;
public class PageEntity extends LexiconPage{
Entity dummyEntity;
int relativeMouseX, relativeMouseY;
boolean tooltipEntity;
int size;
public PageEntity(String unlocalizedName, String entity, int size) {
super(unlocalizedName);
Class EntityClass=(Class) EntityList.stringToClassMapping.get(entity);
this.size=size;
try {
dummyEntity = (Entity)EntityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {null});
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
int text_x = gui.getLeft() + 16;
int text_y = gui.getTop() + gui.getHeight() - 40;
int entity_scale = getEntityScale(size);
int entity_x = gui.getLeft() + gui.getWidth() / 2;
int entity_y = gui.getTop() + gui.getHeight() / 2 + MathHelper.floor_float(dummyEntity.height * entity_scale / 2);
tickEntity(dummyEntity);
renderEntity(gui, dummyEntity, entity_x, entity_y, entity_scale, dummyEntity.ticksExisted * 2);
PageText.renderText(text_x, text_y, gui.getWidth() - 30, gui.getHeight(), getUnlocalizedName());
}
public int getEntityScale(int targetSize)
{
float entity_size = dummyEntity.width;
if(dummyEntity.width < dummyEntity.height)
{
entity_size = dummyEntity.height;
}
return MathHelper.floor_float(size / entity_size);
}
public void tickEntity(Entity entity)
{
dummyEntity.ticksExisted++;
}
public void renderEntity(IGuiLexiconEntry gui, Entity entity, int x, int y, int scale, float rotation)
{
dummyEntity.worldObj = (Minecraft.getMinecraft() != null) ? Minecraft.getMinecraft().theWorld : null;
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, 50.0F);
GL11.glScalef((float)(-scale), (float)scale, (float)scale);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GL11.glTranslatef(0.0F, entity.yOffset, 0.0F);
RenderManager.instance.playerViewY = 180.0F;
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
if(relativeMouseX >= x - (dummyEntity.width * scale / 2) - 10 && relativeMouseY >= y - (dummyEntity.height * scale) - 20 && relativeMouseX <= x + (dummyEntity.width * scale / 2) + 10 && relativeMouseY <= y + 20) {
tooltipEntity = true;
}
}
}
@@ -0,0 +1,147 @@
package vazkii.botania.common.lexicon.page;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
import vazkii.botania.client.gui.lexicon.GuiLexiconEntry;
import vazkii.botania.client.lib.LibResources;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.EntityList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
public class PageShedding extends PageEntity{
private static final ResourceLocation sheddingOverlay = new ResourceLocation(LibResources.GUI_SHEDDING_OVERLAY);
ItemStack shedStack;
ItemStack tooltipStack;
boolean tooltipEntry;
static boolean mouseDownLastTick = false;
public PageShedding(String unlocalizedName, String entity, int size, ItemStack shedStack) {
super(unlocalizedName, entity, size);
this.shedStack = shedStack;
}
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
relativeMouseX = mx;
relativeMouseY = my;
int stack_x = gui.getLeft() + gui.getWidth() / 2 - 8;
int stack_y = gui.getTop() + gui.getHeight() - 40 - 24 - 5;
int entity_scale = getEntityScale(size);
int entity_x = gui.getLeft() + gui.getWidth() / 2;
int entity_y = gui.getTop() + gui.getHeight() / 2 + MathHelper.floor_float(dummyEntity.height * entity_scale / 2) - 35;
tickEntity(dummyEntity);
renderEntity(gui, dummyEntity, entity_x, entity_y, entity_scale, dummyEntity.ticksExisted * 2);
renderItem(gui, stack_x, stack_y, shedStack);
TextureManager render = Minecraft.getMinecraft().renderEngine;
render.bindTexture(sheddingOverlay);
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());
if(tooltipStack != null) {
List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
List<String> parsedTooltip = new ArrayList();
boolean first = true;
for(String s : tooltipData) {
String s_ = s;
if(!first)
s_ = EnumChatFormatting.GRAY + s;
parsedTooltip.add(s_);
first = false;
}
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mx, my, parsedTooltip);
int tooltipY = 8 + tooltipData.size() * 11;
if(tooltipEntry) {
vazkii.botania.client.core.helper.RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList(EnumChatFormatting.GRAY + StatCollector.translateToLocal("botaniamisc.clickToRecipe")));
tooltipY += 18;
}
}
else if(tooltipEntity) {
List<String> parsedTooltip = new ArrayList();
parsedTooltip.add(EntityList.getEntityString(dummyEntity));
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mx, my, parsedTooltip);
}
tooltipStack = null;
tooltipEntry = tooltipEntity = false;
GL11.glDisable(GL11.GL_BLEND);
mouseDownLastTick = Mouse.isButtonDown(0);
}
@SideOnly(Side.CLIENT)
public void renderItem(IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack) {
RenderItem render = new RenderItem();
boolean mouseDown = Mouse.isButtonDown(0);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_DEPTH_TEST);
render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos);
render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos);
RenderHelper.disableStandardItemLighting();
GL11.glPopMatrix();
if(relativeMouseX >= xPos && relativeMouseY >= yPos && relativeMouseX <= xPos + 16 && relativeMouseY <= yPos + 16) {
tooltipStack = stack;
EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack);
if(data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) {
tooltipEntry = true;
if(!mouseDownLastTick && mouseDown && GuiScreen.isShiftKeyDown()) {
GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui);
newGui.page = data.page;
Minecraft.getMinecraft().displayGuiScreen(newGui);
}
}
}
GL11.glDisable(GL11.GL_LIGHTING);
}
}
+1 -1
View File
@@ -1570,7 +1570,7 @@ botania.page.prismarine6=Crafting the &1Sea Lantern&0
# -- NATURAL SHEDDING
botania.entry.shedding=Natural Shedding
botania.page.shedding0=The living beings that inhabit our lands don't live in a static state. It's common for pieces of their body to fall out, &1Feathers&0 on &4Chickens&0, &1Bones&0 on &4Skeletons&0, so on.<br>Even the tough &4Ghasts&0 sometimes shed a tear or the &4Villagers&0 accidentally drop an &1Emerald&0 and can't pick it back up because their arms are stuck together for some reason.
botania.page.shedding0=The living and unliving beings that inhabit our lands don't live in a static state. It's common for pieces of their body to fall out, or for them to drop things, or for them to extrude substances. The following pages list some such items that can come from such entities.
# -- TINY POTATO
botania.entry.tinyPotato=Tiny Potato
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB