mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-24 05:54:47 +00:00
Move static rendering methods to RenderUtil
This commit is contained in:
1 parent
9c4b081f6d
commit
460a7db190
42 files changed
+442
-414
No files matched your search
@@ -17,12 +17,9 @@ import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.minecraft.control.ControlImage;
|
||||
import binnie.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.craftgui.resource.StyleSheet;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.craftgui.resource.minecraft.PaddedTexture;
|
||||
import binnie.craftgui.resource.StyleSheetPunnett;
|
||||
import binnie.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import binnie.extrabees.gui.punnett.ExtraBeeGUITexture;
|
||||
import binnie.genetics.gui.ControlChromosome;
|
||||
import binnie.genetics.machine.analyser.Analyser;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
@@ -110,7 +107,7 @@ public class WindowFieldKit extends Window {
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Field Kit");
|
||||
CraftGUI.render.stylesheet(new StyleSheetPunnett());
|
||||
CraftGUI.render.setStyleSheet(new StyleSheetPunnett());
|
||||
this.getWindowInventory().createSlot(0);
|
||||
this.getWindowInventory().createSlot(1);
|
||||
this.setupValidators();
|
||||
@@ -276,14 +273,4 @@ public class WindowFieldKit extends Window {
|
||||
}
|
||||
}
|
||||
|
||||
static class StyleSheetPunnett extends StyleSheet {
|
||||
public StyleSheetPunnett() {
|
||||
this.textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, ExtraBeeTexture.GUIPunnett, 32, 32, 32, 32));
|
||||
this.textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(CraftGUITexture.HelpButton, new StandardTexture(178, 0, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(CraftGUITexture.InfoButton, new StandardTexture(178, 16, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@ package binnie.craftgui.controls;
|
||||
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.controls.core.IControlValue;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
|
||||
public class ControlText extends Control implements IControlValue<String> {
|
||||
private String text;
|
||||
@@ -28,7 +28,7 @@ public class ControlText extends Control implements IControlValue<String> {
|
||||
|
||||
@Override
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.text(this.getArea(), this.align, this.text, this.getColour());
|
||||
RenderUtil.drawText(this.getArea(), this.align, this.text, this.getColour());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.Position;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.events.EventValueChanged;
|
||||
import binnie.craftgui.minecraft.control.ControlItemDisplay;
|
||||
@@ -98,7 +99,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
if (icon.hasOutline()) {
|
||||
iTexture = CraftGUI.render.getTexture(CraftGUITexture.TabOutline);
|
||||
iTexture = iTexture.crop(position, 8);
|
||||
CraftGUI.render.colour(icon.getOutlineColour());
|
||||
RenderUtil.setColour(icon.getOutlineColour());
|
||||
CraftGUI.render.texture(iTexture, area.inset(2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package binnie.craftgui.core;
|
||||
|
||||
import binnie.craftgui.core.renderer.Renderer;
|
||||
import binnie.craftgui.core.renderer.TextureRenderer;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUIResourceManager;
|
||||
|
||||
public class CraftGUI {
|
||||
public static CraftGUIResourceManager resourceManager;
|
||||
public static final Renderer render = new Renderer();
|
||||
public static final TextureRenderer render = new TextureRenderer();
|
||||
}
|
||||
@@ -3,19 +3,6 @@ package binnie.craftgui.core.geometry;
|
||||
import binnie.craftgui.controls.core.IControlValue;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.events.EventValueChanged;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CraftGUIUtil {
|
||||
public static void alignToWidget(final IWidget target, final IWidget relativeTo) {
|
||||
@@ -75,130 +62,4 @@ public class CraftGUIUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static void renderTexturePadded(final IArea area, final IArea texture, final IBorder padding) {
|
||||
int borderLeft = padding.l();
|
||||
int borderRight = padding.r();
|
||||
int borderTop = padding.t();
|
||||
int borderBottom = padding.b();
|
||||
final int posX = area.pos().x();
|
||||
final int posY = area.pos().y();
|
||||
final int width = area.size().x();
|
||||
final int height = area.size().y();
|
||||
final int textWidth = texture.w();
|
||||
final int textHeight = texture.h();
|
||||
final int u = texture.x();
|
||||
final int v = texture.y();
|
||||
if (borderTop + borderBottom > height) {
|
||||
borderTop = height / 2;
|
||||
borderBottom = height / 2;
|
||||
}
|
||||
if (borderLeft + borderRight > width) {
|
||||
borderLeft = width / 2;
|
||||
borderRight = width / 2;
|
||||
}
|
||||
final IPoint origin = area.pos();
|
||||
GuiUtils.drawTexturedModalRect(posX, posY, u, v, borderLeft, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY, u + textWidth - borderRight, v, borderRight, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX, posY + height - borderBottom, u, v + textHeight - borderBottom, borderLeft, borderBottom, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY + height - borderBottom, u + textWidth - borderRight, v + textHeight - borderBottom, borderRight, borderBottom, 0);
|
||||
int texturingWidth;
|
||||
for (int currentXPos = borderLeft; currentXPos < width - borderRight; currentXPos += texturingWidth) {
|
||||
final int distanceXRemaining = width - borderRight - currentXPos;
|
||||
texturingWidth = textWidth - borderLeft - borderRight;
|
||||
if (texturingWidth > distanceXRemaining) {
|
||||
texturingWidth = distanceXRemaining;
|
||||
}
|
||||
if (texturingWidth <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY, u + borderLeft, v, texturingWidth, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY + height - borderBottom, u + borderLeft, v + textHeight - borderBottom, texturingWidth, borderBottom, 0);
|
||||
int texturingHeight;
|
||||
for (int currentYPos = borderTop; currentYPos < height - borderBottom; currentYPos += texturingHeight) {
|
||||
final int distanceYRemaining = height - borderBottom - currentYPos;
|
||||
texturingHeight = textHeight - borderTop - borderBottom;
|
||||
if (texturingHeight > distanceYRemaining) {
|
||||
texturingHeight = distanceYRemaining;
|
||||
}
|
||||
if (texturingHeight <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY + currentYPos, u + borderLeft, v + borderTop, texturingWidth, texturingHeight, 0);
|
||||
}
|
||||
}
|
||||
int texturingHeight2;
|
||||
for (int currentYPos2 = borderTop; currentYPos2 < height - borderBottom; currentYPos2 += texturingHeight2) {
|
||||
final int distanceYRemaining2 = height - borderBottom - currentYPos2;
|
||||
texturingHeight2 = textHeight - borderTop - borderBottom;
|
||||
if (texturingHeight2 > distanceYRemaining2) {
|
||||
texturingHeight2 = distanceYRemaining2;
|
||||
}
|
||||
if (texturingHeight2 <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX, posY + currentYPos2, u, v + borderTop, borderLeft, texturingHeight2, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY + currentYPos2, u + textWidth - borderRight, v + borderTop, borderRight, texturingHeight2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawRect(float left, float top, float right, float bottom, final int color) {
|
||||
GuiUtils.drawGradientRect(0, (int) left, (int) top, (int) right, (int) bottom, color, color);
|
||||
}
|
||||
|
||||
public static void renderItem(final IPoint pos, final ItemStack itemStack) {
|
||||
renderItem(pos, itemStack, false);
|
||||
}
|
||||
|
||||
public static void renderItem(final IPoint pos, final ItemStack itemStack, final boolean rotating) {
|
||||
Preconditions.checkNotNull(itemStack);
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
FontRenderer font = getFontRenderer(minecraft, itemStack);
|
||||
|
||||
if (rotating) {
|
||||
GlStateManager.pushMatrix();
|
||||
final float phase = Minecraft.getSystemTime() / 20;
|
||||
GlStateManager.translate(8, 8, 0);
|
||||
GlStateManager.rotate(phase, 0, -0.866f, 0.5f);
|
||||
GlStateManager.translate(-8, -8, -67.1f);
|
||||
}
|
||||
|
||||
minecraft.getRenderItem().renderItemAndEffectIntoGUI(null, itemStack, pos.x(), pos.y());
|
||||
minecraft.getRenderItem().renderItemOverlayIntoGUI(font, itemStack, pos.x(), pos.y(), null);
|
||||
|
||||
if (rotating) {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static FontRenderer getFontRenderer(Minecraft minecraft, ItemStack ingredient) {
|
||||
FontRenderer fontRenderer = ingredient.getItem().getFontRenderer(ingredient);
|
||||
if (fontRenderer == null) {
|
||||
fontRenderer = minecraft.fontRendererObj;
|
||||
}
|
||||
return fontRenderer;
|
||||
}
|
||||
|
||||
public static void drawTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
|
||||
double uMin = textureSprite.getMinU();
|
||||
double uMax = textureSprite.getMaxU();
|
||||
double vMin = textureSprite.getMinV();
|
||||
double vMax = textureSprite.getMaxV();
|
||||
uMax = uMax - maskRight / 16.0 * (uMax - uMin);
|
||||
vMax = vMax - maskTop / 16.0 * (vMax - vMin);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
||||
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
|
||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
|
||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
|
||||
vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package binnie.craftgui.core.renderer;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class RenderUtil {
|
||||
|
||||
private RenderUtil() {
|
||||
|
||||
}
|
||||
|
||||
public static void drawItem(final IPoint pos, final ItemStack itemStack) {
|
||||
drawItem(pos, itemStack, false);
|
||||
}
|
||||
|
||||
public static void drawItem(final IPoint pos, final ItemStack itemStack, final boolean rotating) {
|
||||
Preconditions.checkNotNull(itemStack);
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
FontRenderer font = getFontRenderer(minecraft, itemStack);
|
||||
|
||||
if (rotating) {
|
||||
GlStateManager.pushMatrix();
|
||||
final float phase = Minecraft.getSystemTime() / 20;
|
||||
GlStateManager.translate(8, 8, 0);
|
||||
GlStateManager.rotate(phase, 0, -0.866f, 0.5f);
|
||||
GlStateManager.translate(-8, -8, -67.1f);
|
||||
}
|
||||
|
||||
minecraft.getRenderItem().renderItemAndEffectIntoGUI(null, itemStack, pos.x(), pos.y());
|
||||
minecraft.getRenderItem().renderItemOverlayIntoGUI(font, itemStack, pos.x(), pos.y(), null);
|
||||
|
||||
if (rotating) {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static FontRenderer getFontRenderer(Minecraft minecraft, ItemStack ingredient) {
|
||||
FontRenderer fontRenderer = ingredient.getItem().getFontRenderer(ingredient);
|
||||
if (fontRenderer == null) {
|
||||
fontRenderer = minecraft.fontRendererObj;
|
||||
}
|
||||
return fontRenderer;
|
||||
}
|
||||
|
||||
public static void drawTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
|
||||
double uMin = textureSprite.getMinU();
|
||||
double uMax = textureSprite.getMaxU();
|
||||
double vMin = textureSprite.getMinV();
|
||||
double vMax = textureSprite.getMaxV();
|
||||
uMax = uMax - maskRight / 16.0 * (uMax - uMin);
|
||||
vMax = vMax - maskTop / 16.0 * (vMax - vMin);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
||||
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||
vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
|
||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
|
||||
vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
|
||||
vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static void setColour(final int hexColour) {
|
||||
int a = (hexColour & 0xFF000000) >> 24;
|
||||
final int r = (hexColour & 0xFF0000) >> 16;
|
||||
final int g = (hexColour & 0xFF00) >> 8;
|
||||
final int b = hexColour & 0xFF;
|
||||
if (a < 0) {
|
||||
a += 256;
|
||||
}
|
||||
if (a > 0 && a != 255) {
|
||||
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
|
||||
} else {
|
||||
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getTextWidth(final String text) {
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
return fontRendererObj.getStringWidth(text);
|
||||
}
|
||||
|
||||
public static int getTextHeight() {
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
return (fontRendererObj == null) ? 0 : fontRendererObj.FONT_HEIGHT;
|
||||
}
|
||||
|
||||
public static void drawText(final IPoint pos, final String text, final int colour) {
|
||||
drawText(new IArea(pos, new IPoint(500, 500)), TextJustification.TopLeft, text, colour);
|
||||
}
|
||||
|
||||
public static void drawText(final IArea area, final TextJustification justification, final String text, final int colour) {
|
||||
final IPoint pos = area.pos();
|
||||
if (area.size().x() <= 0.0f) {
|
||||
return;
|
||||
}
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
final List<String> wrappedStrings = fontRendererObj.listFormattedStringToWidth(text, area.size().x());
|
||||
final float totalHeight = wrappedStrings.size() * getTextHeight();
|
||||
float posY = area.pos().y();
|
||||
if (area.size().y() > totalHeight) {
|
||||
posY += (area.size().y() - totalHeight) * justification.getYOffset();
|
||||
}
|
||||
for (final String string : wrappedStrings) {
|
||||
final float stringWidth = getTextWidth(string);
|
||||
float posX = area.size().x() - stringWidth;
|
||||
posX *= justification.getXOffset();
|
||||
GlStateManager.disableDepth();
|
||||
fontRendererObj.drawString(string, (int) (pos.x() + posX), (int) posY, colour);
|
||||
posY += getTextHeight();
|
||||
}
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
public static void drawSolidRect(float left, float top, float right, float bottom, final int color) {
|
||||
GuiUtils.drawGradientRect(0, (int) left, (int) top, (int) right, (int) bottom, color, color);
|
||||
}
|
||||
|
||||
public static void drawSolidRect(final IArea area, final int colour) {
|
||||
drawSolidRect(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), 0xFF000000 | colour);
|
||||
}
|
||||
|
||||
public static void drawSolidRectWithAlpha(final IArea area, final int color) {
|
||||
drawSolidRect(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), color);
|
||||
}
|
||||
|
||||
public static void drawGradientRect(final IArea area, final int startColor, final int endColor) {
|
||||
GuiUtils.drawGradientRect(0, area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), startColor, endColor);
|
||||
}
|
||||
|
||||
public static void drawSprite(final IPoint pos, final TextureAtlasSprite icon) {
|
||||
if (icon != null) {
|
||||
BinnieCore.proxy.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
drawTexture(pos.x(), pos.y(), icon, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawFluid(IPoint pos, FluidStack fluid) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if (fluid != null) {
|
||||
Fluid fluid1 = fluid.getFluid();
|
||||
if (fluid1 != null) {
|
||||
TextureAtlasSprite fluidStillSprite = getStillFluidSprite(minecraft, fluid1);
|
||||
|
||||
int fluidColor = fluid1.getColor(fluid);
|
||||
|
||||
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
setColour(fluidColor);
|
||||
drawTexture(pos.x(), pos.y(), fluidStillSprite, 0, 0, 100);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite getStillFluidSprite(Minecraft minecraft, Fluid fluid) {
|
||||
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
||||
ResourceLocation fluidStill = fluid.getStill();
|
||||
TextureAtlasSprite fluidStillSprite = null;
|
||||
if (fluidStill != null) {
|
||||
fluidStillSprite = textureMapBlocks.getTextureExtry(fluidStill.toString());
|
||||
}
|
||||
if (fluidStillSprite == null) {
|
||||
fluidStillSprite = textureMapBlocks.getMissingSprite();
|
||||
}
|
||||
return fluidStillSprite;
|
||||
}
|
||||
}
|
||||
+76
-125
@@ -2,33 +2,95 @@ package binnie.craftgui.core.renderer;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IBorder;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.Position;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import binnie.craftgui.resource.IStyleSheet;
|
||||
import binnie.craftgui.resource.Texture;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.List;
|
||||
public class TextureRenderer {
|
||||
private static void renderTexturePadded(final IArea area, final IArea texture, final IBorder padding) {
|
||||
int borderLeft = padding.l();
|
||||
int borderRight = padding.r();
|
||||
int borderTop = padding.t();
|
||||
int borderBottom = padding.b();
|
||||
final int posX = area.pos().x();
|
||||
final int posY = area.pos().y();
|
||||
final int width = area.size().x();
|
||||
final int height = area.size().y();
|
||||
final int textWidth = texture.w();
|
||||
final int textHeight = texture.h();
|
||||
final int u = texture.x();
|
||||
final int v = texture.y();
|
||||
if (borderTop + borderBottom > height) {
|
||||
borderTop = height / 2;
|
||||
borderBottom = height / 2;
|
||||
}
|
||||
if (borderLeft + borderRight > width) {
|
||||
borderLeft = width / 2;
|
||||
borderRight = width / 2;
|
||||
}
|
||||
final IPoint origin = area.pos();
|
||||
GuiUtils.drawTexturedModalRect(posX, posY, u, v, borderLeft, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY, u + textWidth - borderRight, v, borderRight, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX, posY + height - borderBottom, u, v + textHeight - borderBottom, borderLeft, borderBottom, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY + height - borderBottom, u + textWidth - borderRight, v + textHeight - borderBottom, borderRight, borderBottom, 0);
|
||||
int texturingWidth;
|
||||
for (int currentXPos = borderLeft; currentXPos < width - borderRight; currentXPos += texturingWidth) {
|
||||
final int distanceXRemaining = width - borderRight - currentXPos;
|
||||
texturingWidth = textWidth - borderLeft - borderRight;
|
||||
if (texturingWidth > distanceXRemaining) {
|
||||
texturingWidth = distanceXRemaining;
|
||||
}
|
||||
if (texturingWidth <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY, u + borderLeft, v, texturingWidth, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY + height - borderBottom, u + borderLeft, v + textHeight - borderBottom, texturingWidth, borderBottom, 0);
|
||||
int texturingHeight;
|
||||
for (int currentYPos = borderTop; currentYPos < height - borderBottom; currentYPos += texturingHeight) {
|
||||
final int distanceYRemaining = height - borderBottom - currentYPos;
|
||||
texturingHeight = textHeight - borderTop - borderBottom;
|
||||
if (texturingHeight > distanceYRemaining) {
|
||||
texturingHeight = distanceYRemaining;
|
||||
}
|
||||
if (texturingHeight <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX + currentXPos, posY + currentYPos, u + borderLeft, v + borderTop, texturingWidth, texturingHeight, 0);
|
||||
}
|
||||
}
|
||||
int texturingHeight2;
|
||||
for (int currentYPos2 = borderTop; currentYPos2 < height - borderBottom; currentYPos2 += texturingHeight2) {
|
||||
final int distanceYRemaining2 = height - borderBottom - currentYPos2;
|
||||
texturingHeight2 = textHeight - borderTop - borderBottom;
|
||||
if (texturingHeight2 > distanceYRemaining2) {
|
||||
texturingHeight2 = distanceYRemaining2;
|
||||
}
|
||||
if (texturingHeight2 <= 0) {
|
||||
break;
|
||||
}
|
||||
GuiUtils.drawTexturedModalRect(posX, posY + currentYPos2, u, v + borderTop, borderLeft, texturingHeight2, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY + currentYPos2, u + textWidth - borderRight, v + borderTop, borderRight, texturingHeight2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public class Renderer {
|
||||
private IStyleSheet stylesheet;
|
||||
private IStyleSheet styleSheet;
|
||||
|
||||
public void setStyleSheet(IStyleSheet styleSheet) {
|
||||
this.styleSheet = styleSheet;
|
||||
}
|
||||
|
||||
public final void preRender(final IWidget widget, int guiWidth, int guiHeight) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(widget.getPosition().x(), widget.getPosition().y(), 0.0f);
|
||||
this.colour(widget.getColour());
|
||||
RenderUtil.setColour(widget.getColour());
|
||||
if (widget.isCroppedWidet()) {
|
||||
final IWidget cropRelative = (widget.getCropWidget() != null) ? widget.getCropWidget() : widget;
|
||||
final IPoint pos = cropRelative.getAbsolutePosition();
|
||||
@@ -48,26 +110,11 @@ public class Renderer {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public void colour(final int hex) {
|
||||
int a = (hex & 0xFF000000) >> 24;
|
||||
final int r = (hex & 0xFF0000) >> 16;
|
||||
final int g = (hex & 0xFF00) >> 8;
|
||||
final int b = hex & 0xFF;
|
||||
if (a < 0) {
|
||||
a += 256;
|
||||
}
|
||||
if (a > 0 && a != 255) {
|
||||
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
|
||||
} else {
|
||||
GlStateManager.color(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public Texture getTexture(final Object key) {
|
||||
if (key instanceof Texture) {
|
||||
return (Texture) key;
|
||||
}
|
||||
return this.stylesheet.getTexture(key);
|
||||
return this.styleSheet.getTexture(key);
|
||||
}
|
||||
|
||||
public void setTexture(final Texture texture) {
|
||||
@@ -105,106 +152,10 @@ public class Renderer {
|
||||
final IPoint position = targetArea.pos();
|
||||
GuiUtils.drawTexturedModalRect(position.x(), position.y(), textureArea.pos().x(), textureArea.pos().y(), textureArea.size().x(), textureArea.size().y(), 0);
|
||||
} else {
|
||||
CraftGUIUtil.renderTexturePadded(targetArea, textureArea, texture.getTotalPadding());
|
||||
renderTexturePadded(targetArea, textureArea, texture.getTotalPadding());
|
||||
}
|
||||
}
|
||||
|
||||
public void stylesheet(final IStyleSheet sheet) {
|
||||
this.stylesheet = sheet;
|
||||
}
|
||||
|
||||
public int textWidth(final String text) {
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
return fontRendererObj.getStringWidth(text);
|
||||
}
|
||||
|
||||
public int textHeight() {
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
return (fontRendererObj == null) ? 0 : fontRendererObj.FONT_HEIGHT;
|
||||
}
|
||||
|
||||
public void text(final IPoint pos, final String text, final int colour) {
|
||||
this.text(new IArea(pos, new IPoint(500, 500)), TextJustification.TopLeft, text, colour);
|
||||
}
|
||||
|
||||
public void text(final IArea area, final TextJustification justification, final String text, final int colour) {
|
||||
final IPoint pos = area.pos();
|
||||
if (area.size().x() <= 0.0f) {
|
||||
return;
|
||||
}
|
||||
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
|
||||
final List<String> wrappedStrings = fontRendererObj.listFormattedStringToWidth(text, area.size().x());
|
||||
final float totalHeight = wrappedStrings.size() * this.textHeight();
|
||||
float posY = area.pos().y();
|
||||
if (area.size().y() > totalHeight) {
|
||||
posY += (area.size().y() - totalHeight) * justification.getYOffset();
|
||||
}
|
||||
for (final String string : wrappedStrings) {
|
||||
final float stringWidth = this.textWidth(string);
|
||||
float posX = area.size().x() - stringWidth;
|
||||
posX *= justification.getXOffset();
|
||||
GlStateManager.disableDepth();
|
||||
fontRendererObj.drawString(string, (int) (pos.x() + posX), (int) posY, colour);
|
||||
posY += this.textHeight();
|
||||
}
|
||||
GlStateManager.color(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
public void solid(final IArea area, final int colour) {
|
||||
CraftGUIUtil.drawRect(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), 0xFF000000 | colour);
|
||||
}
|
||||
|
||||
public void solidAlpha(final IArea area, final int color) {
|
||||
CraftGUIUtil.drawRect(area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), color);
|
||||
}
|
||||
|
||||
public void gradientRect(final IArea area, final int startColor, final int endColor) {
|
||||
GuiUtils.drawGradientRect(0, area.pos().x(), area.pos().y(), area.pos().x() + area.size().x(), area.pos().y() + area.size().y(), startColor, endColor);
|
||||
}
|
||||
|
||||
public void sprite(final IPoint pos, final TextureAtlasSprite icon) {
|
||||
if (icon != null) {
|
||||
BinnieCore.proxy.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
CraftGUIUtil.drawTexture(pos.x(), pos.y(), icon, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void fluid(IPoint pos, FluidStack fluid){
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
if (fluid != null) {
|
||||
Fluid fluid1 = fluid.getFluid();
|
||||
if (fluid1 != null) {
|
||||
TextureAtlasSprite fluidStillSprite = getStillFluidSprite(minecraft, fluid1);
|
||||
|
||||
int fluidColor = fluid1.getColor(fluid);
|
||||
|
||||
minecraft.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
colour(fluidColor);
|
||||
CraftGUIUtil.drawTexture(pos.x(), pos.y(), fluidStillSprite, 0, 0, 100);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite getStillFluidSprite(Minecraft minecraft, Fluid fluid) {
|
||||
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
||||
ResourceLocation fluidStill = fluid.getStill();
|
||||
TextureAtlasSprite fluidStillSprite = null;
|
||||
if (fluidStill != null) {
|
||||
fluidStillSprite = textureMapBlocks.getTextureExtry(fluidStill.toString());
|
||||
}
|
||||
if (fluidStillSprite == null) {
|
||||
fluidStillSprite = textureMapBlocks.getMissingSprite();
|
||||
}
|
||||
return fluidStillSprite;
|
||||
}
|
||||
|
||||
public void limitArea(final IArea area, int guiWidth, int guiHeight) {
|
||||
float x = area.pos().x();
|
||||
float y = area.pos().y();
|
||||
@@ -224,7 +175,7 @@ public class Renderer {
|
||||
public int textHeight(final String text, final int width) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
FontRenderer fontRenderer = minecraft.fontRendererObj;
|
||||
return fontRenderer.listFormattedStringToWidth(text, width).size() * this.textHeight();
|
||||
return fontRenderer.listFormattedStringToWidth(text, width).size() * RenderUtil.getTextHeight();
|
||||
}
|
||||
|
||||
public void texturePercentage(final Texture texture, final IArea area, final Position direction, final float percentage) {
|
||||
@@ -1,9 +1,9 @@
|
||||
package binnie.craftgui.extratrees.dictionary;
|
||||
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
public class ControlBlockIconDisplay extends Control {
|
||||
@@ -16,6 +16,6 @@ public class ControlBlockIconDisplay extends Control {
|
||||
|
||||
@Override
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.sprite(IPoint.ZERO, this.icon);
|
||||
RenderUtil.drawSprite(IPoint.ZERO, this.icon);
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,9 @@ import binnie.core.util.ItemStackSet;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.minecraft.control.ControlProgressBase;
|
||||
import binnie.craftgui.resource.Texture;
|
||||
@@ -34,17 +34,17 @@ public class ControlBreweryProgress extends ControlProgressBase {
|
||||
final int fermentedHeight = (int) (32.0f * logic.getProgress() / 100.0f);
|
||||
CraftGUI.render.limitArea(new IArea(new IPoint(1, 6).add(this.getAbsolutePosition()), new IPoint(32, 32 - fermentedHeight)), guiWidth, guiHeight);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
CraftGUI.render.fluid(new IPoint(1, 6), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(17, 6), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(1, 22), logic.currentCrafting.inputFluid);
|
||||
CraftGUI.render.fluid(new IPoint(17, 22), logic.currentCrafting.inputFluid);
|
||||
RenderUtil.drawFluid(new IPoint(1, 6), logic.currentCrafting.inputFluid);
|
||||
RenderUtil.drawFluid(new IPoint(17, 6), logic.currentCrafting.inputFluid);
|
||||
RenderUtil.drawFluid(new IPoint(1, 22), logic.currentCrafting.inputFluid);
|
||||
RenderUtil.drawFluid(new IPoint(17, 22), logic.currentCrafting.inputFluid);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
CraftGUI.render.limitArea(new IArea(new IPoint(1, 38 - fermentedHeight).add(this.getAbsolutePosition()), new IPoint(32, fermentedHeight)), guiWidth, guiHeight);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
CraftGUI.render.fluid(new IPoint(1, 6), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(17, 6), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(1, 22), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
CraftGUI.render.fluid(new IPoint(17, 22), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
RenderUtil.drawFluid(new IPoint(1, 6), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
RenderUtil.drawFluid(new IPoint(17, 6), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
RenderUtil.drawFluid(new IPoint(1, 22), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
RenderUtil.drawFluid(new IPoint(17, 22), BreweryRecipes.getOutput(logic.currentCrafting));
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
final ItemStackSet stacks = new ItemStackSet();
|
||||
Collections.addAll(stacks, logic.currentCrafting.inputGrains);
|
||||
@@ -52,7 +52,7 @@ public class ControlBreweryProgress extends ControlProgressBase {
|
||||
int x = 1;
|
||||
int y = 6;
|
||||
for (final ItemStack stack : stacks) {
|
||||
CraftGUIUtil.renderItem(new IPoint(x, y), stack);
|
||||
RenderUtil.drawItem(new IPoint(x, y), stack);
|
||||
x += 16;
|
||||
if (x > 18) {
|
||||
x = 1;
|
||||
|
||||
@@ -6,6 +6,7 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.Position;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.minecraft.control.ControlProgressBase;
|
||||
@@ -33,7 +34,7 @@ public class ControlDistilleryProgress extends ControlProgressBase {
|
||||
}
|
||||
if (stack != null) {
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
CraftGUI.render.fluid(new IPoint(1, 1 + y * 16), stack);
|
||||
RenderUtil.drawFluid(new IPoint(1, 1 + y * 16), stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package binnie.craftgui.extratrees.dictionary;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.minecraft.control.ControlProgressBase;
|
||||
@@ -34,8 +34,8 @@ public class ControlFruitPressProgress extends ControlProgressBase {
|
||||
return;
|
||||
}
|
||||
FluidStack fluid = FruitPressRecipes.getOutput(input);
|
||||
CraftGUI.render.fluid(new IPoint(4, 52), fluid);
|
||||
CraftGUIUtil.renderItem(new IPoint(4, 52), input);
|
||||
RenderUtil.drawFluid(new IPoint(4, 52), fluid);
|
||||
RenderUtil.drawItem(new IPoint(4, 52), input);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,8 +12,8 @@ import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
@@ -160,12 +160,12 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
|
||||
@Override
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
final ItemStack image = ((WindowWoodworker) this.getSuperParent()).getDesignerType().getDisplayStack(this.getValue());
|
||||
CraftGUIUtil.renderItem(new IPoint(1, 1), image);
|
||||
RenderUtil.drawItem(new IPoint(1, 1), image);
|
||||
if (((IControlValue) this.getParent()).getValue() != this.getValue()) {
|
||||
if (Window.get(this).getMousedOverWidget() == this) {
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), 1157627903, 1157627903);
|
||||
RenderUtil.drawGradientRect(this.getArea().inset(1), 1157627903, 1157627903);
|
||||
} else {
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), -1433892728, -1433892728);
|
||||
RenderUtil.drawGradientRect(this.getArea().inset(1), -1433892728, -1433892728);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package binnie.craftgui.extratrees.kitchen;
|
||||
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -66,10 +66,10 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
GlStateManager.pushMatrix();
|
||||
final float scale = this.getSize().x() / 16.0f;
|
||||
GlStateManager.scale(scale, scale, 1.0f);
|
||||
CraftGUI.render.sprite(IPoint.ZERO, icon);
|
||||
RenderUtil.drawSprite(IPoint.ZERO, icon);
|
||||
GlStateManager.popMatrix();
|
||||
} else {
|
||||
CraftGUI.render.sprite(IPoint.ZERO, icon);
|
||||
RenderUtil.drawSprite(IPoint.ZERO, icon);
|
||||
}
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventWidget;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -40,7 +41,7 @@ public class ControlSlotFluid extends Control implements ITooltip {
|
||||
final int size = (int) this.getSize().x();
|
||||
CraftGUI.render.texture(CraftGUITexture.Slot, this.getArea());
|
||||
if (this.getSuperParent().getMousedOverWidget() == this) {
|
||||
CraftGUI.render.gradientRect(new IArea(new IPoint(1, 1), this.getArea().size().sub(new IPoint(2, 2))), -2130706433, -2130706433);
|
||||
RenderUtil.drawGradientRect(new IArea(new IPoint(1, 1), this.getArea().size().sub(new IPoint(2, 2))), -2130706433, -2130706433);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ import binnie.core.BinnieCore;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.controls.core.IControlValue;
|
||||
import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.genetics.api.IGene;
|
||||
@@ -74,10 +74,10 @@ public class ControlGene extends Control implements IControlValue<IGene>, IToolt
|
||||
@Override
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (this.isMouseOver() && this.canFill(Window.get(this).getHeldItemStack())) {
|
||||
CraftGUI.render.solid(this.getArea(), -1);
|
||||
CraftGUI.render.solid(this.getArea().inset(1), -12303292);
|
||||
RenderUtil.drawSolidRect(this.getArea(), -1);
|
||||
RenderUtil.drawSolidRect(this.getArea().inset(1), -12303292);
|
||||
}
|
||||
CraftGUI.render.colour(-1);
|
||||
CraftGUI.render.sprite(IPoint.ZERO, BinnieCore.proxy.getTextureAtlasSprite(GeneticsTexture.dnaIcon.getResourceLocation()));
|
||||
RenderUtil.setColour(-1);
|
||||
RenderUtil.drawSprite(IPoint.ZERO, BinnieCore.proxy.getTextureAtlasSprite(GeneticsTexture.dnaIcon.getResourceLocation()));
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package binnie.craftgui.genetics.machine;
|
||||
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.minecraft.control.ControlMachineProgress;
|
||||
|
||||
public class ControlProcessTemporary extends ControlMachineProgress {
|
||||
@@ -14,8 +14,8 @@ public class ControlProcessTemporary extends ControlMachineProgress {
|
||||
|
||||
@Override
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.solid(this.getArea(), -4868683);
|
||||
RenderUtil.drawSolidRect(this.getArea(), -4868683);
|
||||
final int w = Math.round(this.getSize().y() * this.progress / 100.0f);
|
||||
CraftGUI.render.solid(new IArea(this.getArea().x(), this.getArea().y(), w, this.getArea().h()), -65536);
|
||||
RenderUtil.drawSolidRect(new IArea(this.getArea().x(), this.getArea().y(), w, this.getArea().h()), -65536);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package binnie.craftgui.genetics.machine;
|
||||
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.minecraft.control.ControlProgressBase;
|
||||
|
||||
public class ControlSplicerProgress extends ControlProgressBase {
|
||||
@@ -41,10 +41,10 @@ public class ControlSplicerProgress extends ControlProgressBase {
|
||||
c3 += alpha;
|
||||
c4 += alpha;
|
||||
int viewAmount = Math.round(offMovement * percentView);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2 + y, viewAmount, 4, h / 2), c1);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2 + y, viewAmount + 4, 4, h / 2), (y < 0) ? c2 : c3);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2 + y, this.h() - viewAmount - 8, 4, h / 2), (y < 0) ? c3 : c2);
|
||||
CraftGUI.render.solidAlpha(new IArea(this.w() / 2 + y, this.h() - viewAmount - 4, 4, h / 2), c4);
|
||||
RenderUtil.drawSolidRectWithAlpha(new IArea(this.w() / 2 + y, viewAmount, 4, h / 2), c1);
|
||||
RenderUtil.drawSolidRectWithAlpha(new IArea(this.w() / 2 + y, viewAmount + 4, 4, h / 2), (y < 0) ? c2 : c3);
|
||||
RenderUtil.drawSolidRectWithAlpha(new IArea(this.w() / 2 + y, this.h() - viewAmount - 8, 4, h / 2), (y < 0) ? c3 : c2);
|
||||
RenderUtil.drawSolidRectWithAlpha(new IArea(this.w() / 2 + y, this.h() - viewAmount - 4, 4, h / 2), c4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventHandler;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
@@ -34,7 +35,7 @@ public abstract class Dialog extends Control {
|
||||
|
||||
@Override
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.gradientRect(this.getArea().outset(400), -1442840576, -1442840576);
|
||||
RenderUtil.drawGradientRect(this.getArea().outset(400), -1442840576, -1442840576);
|
||||
CraftGUI.render.texture(CraftGUITexture.Window, this.getArea());
|
||||
CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().inset(4));
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package binnie.craftgui.minecraft;
|
||||
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventKey;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -86,7 +86,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
final InventoryPlayer playerInventory = this.mc.thePlayer.inventory;
|
||||
this.draggedItem = playerInventory.getItemStack();
|
||||
if (this.draggedItem != null) {
|
||||
CraftGUIUtil.renderItem(new IPoint(mouseX - 8, mouseY - 8), this.draggedItem, false);
|
||||
RenderUtil.drawItem(new IPoint(mouseX - 8, mouseY - 8), this.draggedItem, false);
|
||||
}
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
@@ -178,7 +178,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(i1, j1 - 1.5f, 0.0f);
|
||||
GlStateManager.scale(0.6f, 0.6f, 1.0f);
|
||||
CraftGUIUtil.renderItem(IPoint.ZERO, stack, false);
|
||||
RenderUtil.drawItem(IPoint.ZERO, stack, false);
|
||||
GlStateManager.popMatrix();
|
||||
} catch (NBTException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -20,6 +20,7 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.TopLevelWidget;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventWidget;
|
||||
import binnie.craftgui.minecraft.control.ControlHelp;
|
||||
import binnie.craftgui.minecraft.control.ControlInfo;
|
||||
@@ -140,7 +141,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
for (final EnumHighlighting h : EnumHighlighting.values()) {
|
||||
ControlSlot.highlighting.put(h, new ArrayList<>());
|
||||
}
|
||||
CraftGUI.render.stylesheet(StyleSheetManager.getDefault());
|
||||
CraftGUI.render.setStyleSheet(StyleSheetManager.getDefault());
|
||||
this.titleButtonLeft = -14;
|
||||
if (this.showHelpButton()) {
|
||||
new ControlHelp(this, this.titleButtonLeft += 22, 8);
|
||||
@@ -201,14 +202,14 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
||||
|
||||
@Override
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.colour(16777215);
|
||||
RenderUtil.setColour(16777215);
|
||||
if (this.getBackground1() != null) {
|
||||
CraftGUI.render.texture(this.getBackground1(), IPoint.ZERO);
|
||||
}
|
||||
if (this.getBackground2() != null) {
|
||||
CraftGUI.render.texture(this.getBackground2(), new IPoint(256, 0));
|
||||
}
|
||||
CraftGUI.render.colour(this.getColour());
|
||||
RenderUtil.setColour(this.getColour());
|
||||
CraftGUI.render.texture(CraftGUITexture.Window, this.getArea());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.Position;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.minecraft.MinecraftTooltip;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
@@ -77,7 +78,7 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
||||
CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, this.getArea());
|
||||
final float percentage = this.getPercentage() / 100.0f;
|
||||
int colourFromPercentage = this.getColourFromPercentage(percentage);
|
||||
CraftGUI.render.colour(colourFromPercentage);
|
||||
RenderUtil.setColour(colourFromPercentage);
|
||||
final IArea area = this.getArea();
|
||||
switch (this.direction) {
|
||||
case Top:
|
||||
@@ -95,10 +96,10 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
||||
}
|
||||
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
|
||||
final int c = -1442840576 + MinecraftTooltip.getOutline(Tooltip.Type.Help);
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), c, c);
|
||||
RenderUtil.drawGradientRect(this.getArea().inset(1), c, c);
|
||||
} else if (ControlEnergyBar.isError) {
|
||||
final int c = -1442840576 + MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error);
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), c, c);
|
||||
RenderUtil.drawGradientRect(this.getArea().inset(1), c, c);
|
||||
}
|
||||
CraftGUI.render.texture(CraftGUITexture.EnergyBarGlow, area);
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
@@ -109,11 +110,11 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
|
||||
final IArea area = this.getArea();
|
||||
CraftGUI.render.colour(MinecraftTooltip.getOutline(Tooltip.Type.Help));
|
||||
RenderUtil.setColour(MinecraftTooltip.getOutline(Tooltip.Type.Help));
|
||||
CraftGUI.render.texture(CraftGUITexture.Outline, area.outset(1));
|
||||
} else if (ControlEnergyBar.isError) {
|
||||
final IArea area = this.getArea();
|
||||
CraftGUI.render.colour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error));
|
||||
RenderUtil.setColour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error));
|
||||
CraftGUI.render.texture(CraftGUITexture.Outline, area.outset(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package binnie.craftgui.minecraft.control;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.craftgui.controls.core.Control;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@@ -18,6 +18,6 @@ public class ControlIconDisplay extends Control {
|
||||
|
||||
@Override
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.render.sprite(IPoint.ZERO, this.icon);
|
||||
RenderUtil.drawSprite(IPoint.ZERO, this.icon);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ import binnie.craftgui.core.Attribute;
|
||||
import binnie.craftgui.core.ITooltip;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -55,10 +55,10 @@ public class ControlItemDisplay extends Control implements ITooltip {
|
||||
GlStateManager.pushMatrix();
|
||||
final float scale = this.getSize().x() / 16.0f;
|
||||
GlStateManager.scale(scale, scale, 1);
|
||||
CraftGUIUtil.renderItem(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
RenderUtil.drawItem(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
GlStateManager.popMatrix();
|
||||
} else {
|
||||
CraftGUIUtil.renderItem(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
RenderUtil.drawItem(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
}
|
||||
GlStateManager.enableAlpha();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.MinecraftTooltip;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
@@ -76,15 +77,15 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
CraftGUI.render.texture(this.horizontal ? CraftGUITexture.HorizontalLiquidTank : CraftGUITexture.LiquidTank, IPoint.ZERO);
|
||||
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
|
||||
final int c = -1442840576 + MinecraftTooltip.getOutline(Tooltip.Type.Help);
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), c, c);
|
||||
RenderUtil.drawGradientRect(this.getArea().inset(1), c, c);
|
||||
} else if (ControlLiquidTank.tankError.contains(this.tankID)) {
|
||||
final int c = -1442840576 + MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error);
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), c, c);
|
||||
RenderUtil.drawGradientRect(this.getArea().inset(1), c, c);
|
||||
} else if (this.getSuperParent().getMousedOverWidget() == this) {
|
||||
if (Window.get(this).getGui().getDraggedItem() != null) {
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), -1426089575, -1426089575);
|
||||
RenderUtil.drawGradientRect(this.getArea().inset(1), -1426089575, -1426089575);
|
||||
} else {
|
||||
CraftGUI.render.gradientRect(this.getArea().inset(1), -2130706433, -2130706433);
|
||||
RenderUtil.drawGradientRect(this.getArea().inset(1), -2130706433, -2130706433);
|
||||
}
|
||||
}
|
||||
if (this.isTankValid()) {
|
||||
@@ -113,7 +114,7 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
for (int y = 0; y < height; y += 16) {
|
||||
for (int x = 0; x < (this.horizontal ? 58 : 16); x += 16) {
|
||||
final TextureAtlasSprite icon = BinnieCore.proxy.getTextureAtlasSprite(fluid.getStill());
|
||||
CraftGUI.render.sprite(new IPoint(1 + x, 1 + y), icon);
|
||||
RenderUtil.drawSprite(new IPoint(1 + x, 1 + y), icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,12 +130,12 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
CraftGUI.render.texture(this.horizontal ? CraftGUITexture.HorizontalLiquidTankOverlay : CraftGUITexture.LiquidTankOverlay, IPoint.ZERO);
|
||||
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
|
||||
final IArea area = this.getArea();
|
||||
CraftGUI.render.colour(MinecraftTooltip.getOutline(Tooltip.Type.Help));
|
||||
RenderUtil.setColour(MinecraftTooltip.getOutline(Tooltip.Type.Help));
|
||||
CraftGUI.render.texture(CraftGUITexture.Outline, area.outset(1));
|
||||
}
|
||||
if (ControlLiquidTank.tankError.contains(this.tankID)) {
|
||||
final IArea area = this.getArea();
|
||||
CraftGUI.render.colour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error));
|
||||
RenderUtil.setColour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.Error));
|
||||
CraftGUI.render.texture(CraftGUITexture.Outline, area.outset(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import binnie.craftgui.core.geometry.IBorder;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.geometry.Position;
|
||||
import binnie.craftgui.core.geometry.TextJustification;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.resource.Texture;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -37,8 +38,8 @@ public class ControlSlide extends Control {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
if (this.label != null) {
|
||||
final int lw = CraftGUI.render.textWidth(this.label) + 16;
|
||||
final int lh = CraftGUI.render.textHeight() + 16;
|
||||
final int lw = RenderUtil.getTextWidth(this.label) + 16;
|
||||
final int lh = RenderUtil.getTextHeight() + 16;
|
||||
final boolean hor = this.anchor.x() != 0;
|
||||
final IArea ar = this.isSlideActive() ? this.expanded : this.shrunk;
|
||||
IArea tabArea = new IArea(hor ? (-lh / 2) : (-lw / 2), hor ? (-lw / 2) : (-lh / 2), hor ? lh : lw, hor ? lw : lh);
|
||||
@@ -57,7 +58,7 @@ public class ControlSlide extends Control {
|
||||
if (this.anchor.y() > 0) {
|
||||
GlStateManager.translate(0.0f, -lh, 0.0f);
|
||||
}
|
||||
CraftGUI.render.text(labelArea, TextJustification.MiddleCenter, this.label, 16777215);
|
||||
RenderUtil.drawText(labelArea, TextJustification.MiddleCenter, this.label, 16777215);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
CraftGUI.render.texture(CraftGUITexture.Window, this.getArea());
|
||||
|
||||
@@ -8,6 +8,7 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventMouse;
|
||||
import binnie.craftgui.minecraft.CustomSlot;
|
||||
import binnie.craftgui.minecraft.InventoryType;
|
||||
@@ -70,7 +71,7 @@ public class ControlSlot extends ControlSlotBase {
|
||||
final TextureAtlasSprite icon = validator.getIcon(!islot.getInputSides().isEmpty());
|
||||
if (icon != null) {
|
||||
GlStateManager.enableBlend();
|
||||
CraftGUI.render.sprite(new IPoint(1, 1), icon);
|
||||
RenderUtil.drawSprite(new IPoint(1, 1), icon);
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
}
|
||||
@@ -85,13 +86,13 @@ public class ControlSlot extends ControlSlotBase {
|
||||
}
|
||||
highlighted = true;
|
||||
final int c = -1442840576 + Math.min(highlight.getKey().getColour(), 16777215);
|
||||
CraftGUI.render.gradientRect(new IArea(1, 1, 16, 16), c, c);
|
||||
RenderUtil.drawGradientRect(new IArea(1, 1, 16, 16), c, c);
|
||||
}
|
||||
if (!highlighted && this.getSuperParent().getMousedOverWidget() == this) {
|
||||
if (Window.get(this).getGui().getDraggedItem() != null && !this.slot.isItemValid(Window.get(this).getGui().getDraggedItem())) {
|
||||
CraftGUI.render.gradientRect(new IArea(1, 1, 16, 16), -1426089575, -1426089575);
|
||||
RenderUtil.drawGradientRect(new IArea(1, 1, 16, 16), -1426089575, -1426089575);
|
||||
} else {
|
||||
CraftGUI.render.gradientRect(new IArea(1, 1, 16, 16), -2130706433, -2130706433);
|
||||
RenderUtil.drawGradientRect(new IArea(1, 1, 16, 16), -2130706433, -2130706433);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +117,7 @@ public class ControlSlot extends ControlSlotBase {
|
||||
area = this.getParent().getArea();
|
||||
area.setPosition(IPoint.ZERO.sub(this.getPosition()));
|
||||
}
|
||||
CraftGUI.render.colour(c);
|
||||
RenderUtil.setColour(c);
|
||||
CraftGUI.render.texture(CraftGUITexture.Outline, area.outset(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.events.EventWidget;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
@@ -43,7 +44,7 @@ public abstract class ControlSlotBase extends Control implements ITooltip {
|
||||
final int size = (int) this.getSize().x();
|
||||
CraftGUI.render.texture(CraftGUITexture.Slot, this.getArea());
|
||||
if (this.getSuperParent().getMousedOverWidget() == this) {
|
||||
CraftGUI.render.gradientRect(new IArea(new IPoint(1, 1), this.getArea().size().sub(new IPoint(2, 2))), -2130706433, -2130706433);
|
||||
RenderUtil.drawGradientRect(new IArea(new IPoint(1, 1), this.getArea().size().sub(new IPoint(2, 2))), -2130706433, -2130706433);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.geometry.IArea;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import binnie.craftgui.resource.Texture;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITextureSheet;
|
||||
@@ -27,7 +28,7 @@ class ControlBreedingProgress extends Control {
|
||||
CraftGUI.render.texture(CraftGUITexture.PanelBlack, this.getArea());
|
||||
final IArea area = this.getArea().inset(1);
|
||||
area.setSize(new IPoint(Math.round(area.size().x() * this.percentage), area.size().y()));
|
||||
CraftGUI.render.colour(this.colour);
|
||||
RenderUtil.setColour(this.colour);
|
||||
CraftGUI.render.texture(ControlBreedingProgress.Progress, area);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package binnie.craftgui.mod.database;
|
||||
import binnie.Binnie;
|
||||
import binnie.craftgui.controls.ControlText;
|
||||
import binnie.craftgui.controls.ControlTextCentered;
|
||||
import binnie.craftgui.core.CraftGUI;
|
||||
import binnie.craftgui.core.IWidget;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PageBranchOverview extends PageBranch {
|
||||
String line = "";
|
||||
final List<String> descLines = new ArrayList<>();
|
||||
for (final String str : desc.split(" ")) {
|
||||
if (CraftGUI.render.textWidth(line + " " + str) > 134) {
|
||||
if (RenderUtil.getTextWidth(line + " " + str) > 134) {
|
||||
descLines.add(TextFormatting.ITALIC + line + TextFormatting.RESET);
|
||||
line = "";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package binnie.craftgui.resource;
|
||||
|
||||
import binnie.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.craftgui.resource.minecraft.PaddedTexture;
|
||||
import binnie.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import binnie.extrabees.gui.punnett.ExtraBeeGUITexture;
|
||||
|
||||
public class StyleSheetPunnett extends StyleSheet {
|
||||
public StyleSheetPunnett() {
|
||||
this.textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, ExtraBeeTexture.GUIPunnett, 32, 32, 32, 32));
|
||||
this.textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(CraftGUITexture.HelpButton, new StandardTexture(178, 0, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(CraftGUITexture.InfoButton, new StandardTexture(178, 16, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user