mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 19:59:36 +00:00
Changed the mana HUD texture. It now is less noisy and has points indicating the 25%, 50% and 75% marks. Also added a "progress pie" to the runic altar.
This commit is contained in:
1 parent
554f115f4f
commit
ec4f6be3b0
4 files changed
+82
-2
No files matched your search
@@ -314,7 +314,7 @@ public final class HUDHandler {
|
||||
if(manaPercentage == 0 && mana > 0)
|
||||
manaPercentage = 1;
|
||||
|
||||
RenderHelper.drawTexturedModalRect(x + 1 + manaPercentage, y + 1, 0, 0, 5, 100 - manaPercentage, 3);
|
||||
RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0, 0, 5, 100, 3);
|
||||
|
||||
Color color_ = new Color(color);
|
||||
GL11.glColor4ub((byte) color_.getRed(), (byte) color_.getGreen(),(byte) color_.getBlue(), (byte) (255F * alpha));
|
||||
|
||||
@@ -15,6 +15,8 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -25,14 +27,16 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.wand.IWandHUD;
|
||||
import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.tile.TileRuneAltar;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.block.tile.mana.TileSpreader;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockRuneAltar extends BlockModContainer implements IWandable, ILexiconable {
|
||||
public class BlockRuneAltar extends BlockModContainer implements IWandable, IWandHUD, ILexiconable {
|
||||
|
||||
Random random;
|
||||
IIcon[] icons;
|
||||
@@ -160,4 +164,10 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, ILex
|
||||
return LexiconData.runicAltar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
|
||||
((TileRuneAltar) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,6 +13,13 @@ package vazkii.botania.common.block.tile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -20,11 +27,16 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.mana.IManaReceiver;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -260,6 +272,64 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
|
||||
return !isFull();
|
||||
}
|
||||
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
if(manaToGet > 0) {
|
||||
int x = res.getScaledWidth() / 2 + 20;
|
||||
int y = res.getScaledHeight() / 2 - 8;
|
||||
|
||||
RecipeRuneAltar recipe = null;
|
||||
for(RecipeRuneAltar recipe_ : BotaniaAPI.runeAltarRecipes)
|
||||
if(recipe_.matches(this)) {
|
||||
recipe = recipe_;
|
||||
break;
|
||||
}
|
||||
if(recipe == null)
|
||||
return;
|
||||
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recipe.getOutput(), x, y);
|
||||
|
||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.glEnable(GL11.GL_STENCIL_TEST);
|
||||
GL11.glColorMask(false, false, false, false);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glStencilFunc(GL11.GL_NEVER, 1, 0xFF);
|
||||
GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP);
|
||||
GL11.glStencilMask(0xFF);
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recipe.getOutput(), x, y);
|
||||
|
||||
mc.renderEngine.bindTexture(new ResourceLocation(LibResources.GUI_MANA_HUD));
|
||||
int r = 10;
|
||||
int centerX = x + 8;
|
||||
int centerY = y + 8;
|
||||
int degs = (int) (360 * ((double) mana / (double) manaToGet));
|
||||
float a = 0.5F + 0.2F * ((float) Math.cos((double) ClientTickHandler.ticksInGame / 10) * 0.5F + 0.5F);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColorMask(true, true, true, true);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glStencilMask(0x00);
|
||||
GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF);
|
||||
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
|
||||
GL11.glColor4f(0F, 0.5F, 0.5F, a);
|
||||
GL11.glVertex2i(centerX, centerY);
|
||||
GL11.glColor4f(0F, 1F, 0.5F, a);
|
||||
for(int i = degs; i > 0; i--) {
|
||||
double rad = (i - 90) / 180F * Math.PI;
|
||||
GL11.glVertex2d(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r);
|
||||
}
|
||||
GL11.glVertex2i(centerX, centerY);
|
||||
GL11.glEnd();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_STENCIL_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
public int getTargetMana() {
|
||||
return manaToGet;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 7.2 KiB |
Reference in new issue
Block a user