Ratios and Baubles.

This commit is contained in:
Vasco Lavos committed 2014-07-11 02:48:12 +01:00
1 parent 9833ed0298
commit e0c63f2d85
8 files changed
+143 -6

No files matched your search

@@ -23,11 +23,13 @@ import vazkii.botania.api.mana.IManaCollector;
import vazkii.botania.api.mana.TileSignature;
import vazkii.botania.client.core.handler.LightningHandler.LightningBolt;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.item.ItemTwigWand;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Type;
public class ClientTickHandler {
@@ -37,8 +39,8 @@ public class ClientTickHandler {
public static int ticksInGame = 0;
@SubscribeEvent
public void tickEnd(ClientTickEvent event) {
if(event.phase == Phase.END && event.type == Type.CLIENT) {
public void clientTickEnd(ClientTickEvent event) {
if(event.phase == Phase.END) {
LightningBolt.update();
if(Minecraft.getMinecraft().theWorld == null)
@@ -83,6 +85,12 @@ public class ClientTickHandler {
}
}
}
@SubscribeEvent
public void renderTickEnd(RenderTickEvent event) {
if(event.phase == Phase.END && ConfigHandler.baublesInventoryButton)
InventoryBaublesButtonHandler.renderBaublesIcon();
}
public static void notifyPageChange() {
if(pageFlipTicks == 0)
@@ -0,0 +1,92 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Jul 11, 2014, 2:27:15 AM (GMT)]
*/
package vazkii.botania.client.core.handler;
import java.util.Arrays;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibResources;
import baubles.client.gui.GuiPlayerExpanded;
public final class InventoryBaublesButtonHandler {
static ResourceLocation icon = new ResourceLocation(LibResources.GUI_BAUBLES);
static boolean mouseDown = false;
public static void renderBaublesIcon() {
Minecraft mc = Minecraft.getMinecraft();
if(mc.currentScreen != null && (mc.currentScreen instanceof GuiInventory || mc.currentScreen instanceof GuiContainerCreative || mc.currentScreen instanceof GuiPlayerExpanded)) {
boolean creative = mc.currentScreen instanceof GuiContainerCreative;
boolean baubles = mc.currentScreen instanceof GuiPlayerExpanded;
ScaledResolution res = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
int x = res.getScaledWidth() / 2 - 19;
int y = res.getScaledHeight() / 2 - 75;
if(creative) {
GuiContainerCreative container = (GuiContainerCreative) mc.currentScreen;
if(container.func_147056_g() == CreativeTabs.tabInventory.getTabIndex()) {
x -= 26;
y += 13;
} else return;
}
RenderHelper.disableStandardItemLighting();
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
mc.renderEngine.bindTexture(icon);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.addVertexWithUV(x * 2, y * 2 + 16, 0, 0, 1);
tess.addVertexWithUV(x * 2 + 16, y * 2 + 16, 0, 1, 1);
tess.addVertexWithUV(x * 2 + 16, y * 2, 0, 1, 0);
tess.addVertexWithUV(x * 2, y * 2, 0, 0, 0);
tess.draw();
GL11.glScalef(2F, 2F, 2F);
GL11.glDisable(GL11.GL_BLEND);
int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight;
if(mouseX >= x && mouseX < x + 8 && mouseY >= y && mouseY < y + 8) {
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mouseX, mouseY, Arrays.asList(EnumChatFormatting.LIGHT_PURPLE + StatCollector.translateToLocal(baubles ? "botaniamisc.openInv" : "botaniamisc.openBaubles")));
if(Mouse.isButtonDown(0) && !mouseDown) {
mc.displayGuiScreen(baubles ? new GuiInventory(mc.thePlayer) : new GuiPlayerExpanded(mc.thePlayer));
mouseDown = true;
}
}
}
if(mouseDown && !Mouse.isButtonDown(0))
mouseDown = false;
}
}
@@ -28,6 +28,7 @@ public final class LibResources {
public static final String GUI_MANA_HUD = PREFIX_GUI + "manaHud.png";
public static final String GUI_LEXICON = PREFIX_GUI + "lexicon.png";
public static final String GUI_BAUBLES = PREFIX_GUI + "baubles.png";
public static final String GUI_CRAFTING_OVERLAY = PREFIX_GUI + "craftingOverlay.png";
public static final String GUI_MANA_INFUSION_OVERLAY = PREFIX_GUI + "manaInfusionOverlay.png";
public static final String GUI_PETAL_OVERLAY = PREFIX_GUI + "petalOverlay.png";
@@ -37,6 +37,7 @@ public final class ConfigHandler {
public static boolean elfPortalParticlesEnabled = true;
public static boolean matrixMode = false;
public static boolean referencesEnabled = true;
public static boolean baublesInventoryButton = true;
public static boolean versionCheckEnabled = true;
public static int spreaderPositionShift = 1;
@@ -108,6 +109,9 @@ public final class ConfigHandler {
desc = "Set to false to disable the references in flower tooltips. (You monster D:)";
referencesEnabled = loadPropBool("references.enabled", desc, referencesEnabled);
desc = "Set to false to disable the inventory button to open the Baubles menu.";
baublesInventoryButton = loadPropBool("baublesButton.enabled", desc, baublesInventoryButton);
desc = "Set to false to disable checking and alerting when new Botania versions come out.";
versionCheckEnabled = loadPropBool("versionChecking.enabled", desc, versionCheckEnabled);
@@ -83,7 +83,22 @@ public class PageManaInfusionRecipe extends PageRecipe {
String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage");
font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 105, 0x66000000);
HUDHandler.renderManaBar(gui.getLeft() + gui.getWidth() / 2 - 50, gui.getTop() + 115, 0x0000FF, 0.75F, recipe.getManaToConsume(), TilePool.MAX_MANA / 10);
int ratio = 10;
int x = gui.getLeft() + gui.getWidth() / 2 - 50;
int y = gui.getTop() + 115;
if(mx > x + 1 && mx <= x + 101 && my > y - 14 && my <= y + 11)
ratio = 1;
HUDHandler.renderManaBar(x, y, 0x0000FF, 0.75F, recipe.getManaToConsume(), TilePool.MAX_MANA / ratio);
String ratioString = String.format(StatCollector.translateToLocal("botaniamisc.ratio"), ratio);
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
font.drawString(ratioString, x + 100 - font.getStringWidth(ratioString), y + 5, 0x50000000);
font.setUnicodeFlag(unicode);
GL11.glDisable(GL11.GL_BLEND);
render.bindTexture(manaInfusionOverlay);
@@ -50,10 +50,23 @@ public class PageRuneRecipe extends PagePetalRecipe<RecipeRuneAltar> {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage");
font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 120, 0x66000000);
font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 115, 0x66000000);
HUDHandler.renderManaBar(gui.getLeft() + gui.getWidth() / 2 - 50, gui.getTop() + 130, 0x0000FF, 0.75F, recipe.getManaUsage(), TilePool.MAX_MANA / 10);
GL11.glDisable(GL11.GL_BLEND);
int ratio = 10;
int x = gui.getLeft() + gui.getWidth() / 2 - 50;
int y = gui.getTop() + 125;
if(mx > x + 1 && mx <= x + 101 && my > y - 14 && my <= y + 11)
ratio = 1;
HUDHandler.renderManaBar(x, y, 0x0000FF, 0.75F, recipe.getManaUsage(), TilePool.MAX_MANA / ratio);
String ratioString = String.format(StatCollector.translateToLocal("botaniamisc.ratio"), ratio);
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
font.drawString(ratioString, x + 100 - font.getStringWidth(ratioString), y + 5, 0x50000000);
font.setUnicodeFlag(unicode); GL11.glDisable(GL11.GL_BLEND);
}
}
+4
View File
@@ -41,6 +41,9 @@ botaniamisc.bookmark=Bookmark #%s
botaniamisc.clickToSee=Click to read
botaniamisc.shiftToRemove=Shift-click to remove
botaniamisc.clickToAdd=Click to add a Bookmark here
botaniamisc.ratio=%s:1 Ratio
botaniamisc.openBaubles=Baubles Inventory
botaniamisc.openInv=Normal Inventory
# COLORS
botania.color0=White
@@ -88,6 +91,7 @@ pylonModel.old=Use Old Pylon Model
elfPortal.particles.enabled=Enable Portal Particles
matrixMode.enabled=Enable Matrix Mode
references.enabled=Enable Tooltip References
baublesButton.enabled=Baubles Button Enabled
shaders.enabled=Enable Shader Usage
spreader.posShift=Spreader Pos Shift
versionChecking.enabled=Enable Version Checking
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB