Permalink
Browse files

Fixed some rendering issues with HUDs.

Item drawing and player face drawing.
  • Loading branch information...
Ri5ux committed Dec 17, 2017
1 parent 33196d6 commit 7c5f76b013458de93cd15cc34fcab4d3fcc5bee9
@@ -90,7 +90,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
Draw.drawRect(2, stackY - 2, this.xSize - 4, 12, 0x22FFFFFF);
Draw.drawString(curStackSize + "/" + stack.stackSize, 220, stackY, curStackSize >= stack.stackSize ? 0xFF00AAFF : curStackSize < stack.stackSize && curStackSize > 0 ? 0xFFFFAA00 : 0xFF888888);
Draw.drawString(stack.getDisplayName(), 20, stackY, 0xFF888888);
Draw.drawItemIcon(stack.getItem(), 5, stackY, 8, 8);
Draw.drawItem(stack, 5, stackY, 8, 8);
maxProgress += stack.stackSize;
@@ -136,7 +136,7 @@ protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
OpenGL.enableBlend();
OpenGL.disableBlend();
Draw.drawString((curItem + 1) + " " + I18n.translateToLocal(item.getUnlocalizedName() + ".name"), entryX + 13, entryY + 2, curItem == this.scroll ? 0xFF00AAFF : 0xFF555555, false);
Draw.drawItemIcon(item, entryX + 2, entryY + 2, 8, 8);
Draw.drawItem(schematic.getItemStackAssembled(), entryX + 2, entryY + 2, 8, 8);
}
}
}
@@ -23,8 +23,6 @@
import com.arisux.mdx.lib.client.render.ScaledResolution;
import com.arisux.mdx.lib.client.render.Screen;
import com.arisux.mdx.lib.game.Game;
import com.arisux.mdx.lib.world.Pos;
import com.arisux.mdx.lib.world.Worlds;
import com.arisux.mdx.lib.world.block.Blocks;
import com.arisux.mdx.lib.world.entity.player.inventory.Inventories;
@@ -35,6 +33,8 @@
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@@ -151,57 +151,57 @@ public void drawInfoBar()
OpenGL.popMatrix();
OpenGL.color4i(0xFFFFFFFF);
Draw.drawPlayerFace(Game.minecraft().player.getName(), 0, 0, 32, 32);
Draw.drawPlayerFace(Game.minecraft().player, 0, 0, 32, 32);
/** Silica storm detection indicator **/
WorldProvider provider = Game.minecraft().world.provider;
if (provider instanceof WorldProviderVarda)
{
WorldProviderVarda providerVarda = (WorldProviderVarda) provider;
long stormStartTime = providerVarda.getStormProvider().getStormStartTime() * 1000L;
long stormEndTime = providerVarda.getStormProvider().getStormEndTime() * 1000L;
long worldTime = providerVarda.getWorldTime();
int warningTime = 1000;
int timeUntilStorm = (int) (stormStartTime - provider.getWorldTime());
if ((timeUntilStorm < warningTime && worldTime < stormStartTime || worldTime > stormStartTime && worldTime % 20 <= 10) && worldTime <= stormEndTime + 1000)
{
OpenGL.enableBlend();
OpenGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
int indicatorWidth = 300;
int indicatorHeight = 30;
int indicatorX = (Screen.scaledDisplayResolution().getScaledWidth() / 2) - (indicatorWidth / 2);
int indicatorY = 0;
Draw.drawRect(indicatorX, indicatorY, indicatorWidth, indicatorHeight, 0x66333333);
OpenGL.pushMatrix();
{
float nameScale = 1.5F;
OpenGL.scale(nameScale, nameScale, nameScale);
int actualX = (int) ((indicatorX) / nameScale);
int actualY = (int) ((indicatorY) / nameScale);
int actualWidth = (int) (indicatorWidth / nameScale);
int actualHeight = (int) (indicatorHeight / nameScale);
fontrenderer.drawString("Storm Indicator for " + provider.getDimensionType().getName(), actualX + 7, actualY + 7, 0xFFAA00);
if (Worlds.canSeeSky(new Pos(Game.minecraft().player), Game.minecraft().world))
{
Draw.drawStringAlignCenter("You are outdoors, take cover immediately!", (int) ((Screen.scaledDisplayResolution().getScaledWidth() / 2) / nameScale), actualY + 35, 0xFF0000);
}
if (worldTime > stormStartTime)
{
Draw.drawProgressBar("Storm Inbound", (int) stormStartTime, 0, actualX, actualY + 20, actualWidth, 4, 2, 0xFFFFAA00, false);
}
else
{
Draw.drawProgressBar("Time Until Storm (" + (timeUntilStorm / 20) + " seconds)", (int) stormStartTime, ((int) stormStartTime - (int) worldTime), actualX, actualY + 20, actualWidth, 4, 2, (timeUntilStorm / 20) < 15 ? 0xFFFF0000 : 0xFFFFAA00, false);
}
}
OpenGL.popMatrix();
OpenGL.color4i(0xFFFFFFFF);
}
// long stormStartTime = providerVarda.getStormProvider().getStormStartTime() * 1000L;
// long stormEndTime = providerVarda.getStormProvider().getStormEndTime() * 1000L;
// long worldTime = providerVarda.getWorldTime();
// int warningTime = 1000;
// int timeUntilStorm = (int) (stormStartTime - provider.getWorldTime());
// if ((timeUntilStorm < warningTime && worldTime < stormStartTime || worldTime > stormStartTime && worldTime % 20 <= 10) && worldTime <= stormEndTime + 1000)
// {
// OpenGL.enableBlend();
// OpenGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
// int indicatorWidth = 300;
// int indicatorHeight = 30;
// int indicatorX = (Screen.scaledDisplayResolution().getScaledWidth() / 2) - (indicatorWidth / 2);
// int indicatorY = 0;
// Draw.drawRect(indicatorX, indicatorY, indicatorWidth, indicatorHeight, 0x66333333);
// OpenGL.pushMatrix();
// {
// float nameScale = 1.5F;
// OpenGL.scale(nameScale, nameScale, nameScale);
//
// int actualX = (int) ((indicatorX) / nameScale);
// int actualY = (int) ((indicatorY) / nameScale);
// int actualWidth = (int) (indicatorWidth / nameScale);
// int actualHeight = (int) (indicatorHeight / nameScale);
// fontrenderer.drawString("Storm Indicator for " + provider.getDimensionType().getName(), actualX + 7, actualY + 7, 0xFFAA00);
//
// if (Worlds.canSeeSky(new Pos(Game.minecraft().player), Game.minecraft().world))
// {
// Draw.drawStringAlignCenter("You are outdoors, take cover immediately!", (int) ((Screen.scaledDisplayResolution().getScaledWidth() / 2) / nameScale), actualY + 35, 0xFF0000);
// }
//
// if (worldTime > stormStartTime)
// {
// Draw.drawProgressBar("Storm Inbound", (int) stormStartTime, 0, actualX, actualY + 20, actualWidth, 4, 2, 0xFFFFAA00, false);
// }
// else
// {
// Draw.drawProgressBar("Time Until Storm (" + (timeUntilStorm / 20) + " seconds)", (int) stormStartTime, ((int) stormStartTime - (int) worldTime), actualX, actualY + 20, actualWidth, 4, 2, (timeUntilStorm / 20) < 15 ? 0xFFFF0000 : 0xFFFFAA00, false);
// }
// }
// OpenGL.popMatrix();
// OpenGL.color4i(0xFFFFFFFF);
// }
}
if (Game.minecraft().player != null)
@@ -325,7 +325,7 @@ public void drawInfoBar()
Block block = blockstate.getBlock();
TileEntity tile = Game.minecraft().player.world.getTileEntity(blockpos);
Draw.drawBlockSide(block, Game.minecraft().objectMouseOver.sideHit.ordinal(), subMenuX + subMenuPadding - 56, 0, 48, 48);
Draw.drawItem(new ItemStack(Item.getItemFromBlock(block), 1), subMenuX + subMenuPadding - 56, 0, 48, 48);
OpenGL.pushMatrix();
{
@@ -11,7 +11,9 @@
import com.arisux.mdx.lib.client.render.Draw;
import com.arisux.mdx.lib.client.render.OpenGL;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
public class RenderAssembler extends TileEntitySpecialRenderer<TileEntityAssembler>
{
@@ -24,7 +26,6 @@ public void renderTileEntityAt(TileEntityAssembler tile, double posX, double pos
OpenGL.enable(GL_BLEND);
OpenGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
OpenGL.translate(posX + 0.5F, posY + 0.95F, posZ + 0.5F);
OpenGL.rotate(tile.getWorld().getWorldTime() % 360 * 12, 0, 1, 0);
OpenGL.pushMatrix();
@@ -34,30 +35,25 @@ public void renderTileEntityAt(TileEntityAssembler tile, double posX, double pos
OpenGL.color4i(0xFFFF0000);
OpenGL.enable(GL_BLEND);
OpenGL.blendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_COLOR);
Draw.drawItemIcon(((TileEntityAssembler) tile).getRandomItem(), -8, -32, 16, 16);
Draw.renderItem(new ItemStack(((TileEntityAssembler) tile).getRandomItem(), 1), -8, -32);
OpenGL.disable(GL_BLEND);
OpenGL.enableLight();
}
OpenGL.popMatrix();
OpenGL.rotate(-15, 1, 0, 0);
// GlStateManager.rotate(10, 0, 0, 1);
OpenGL.pushMatrix();
{
OpenGL.scale(0.05F, 0.05F, 0.05F);
OpenGL.disableLight();
OpenGL.enable(GL11.GL_BLEND);
OpenGL.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_CONSTANT_COLOR);
for (int x = 32; x > 0; x--)
{
OpenGL.rotate(x * 1, 0, 1, 0);
OpenGL.rotate(10, 0, 0, 1);
Draw.drawRect(-1, 0, 2, 1 + x / 2, 0x22FF0000);
}
OpenGL.enableLight();
}
OpenGL.popMatrix();
@@ -73,7 +73,7 @@ public void renderTileEntityAt(TileEntityLocker tile, double x, double y, double
OpenGL.pushMatrix();
{
OpenGL.rotate(-45, 1F, 0F, 0F);
Draw.drawItemIcon(stack.getItem(), 0, 0, 32, 32);
Draw.drawItem(stack, 0, 0, 32, 32);
}
OpenGL.popMatrix();
}

0 comments on commit 7c5f76b

Please sign in to comment.