Use the GL state manager everywhere
This commit is contained in:
@@ -8,7 +8,6 @@ import net.minecraft.inventory.Container;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.gui.sidebutton.SideButton;
|
import refinedstorage.gui.sidebutton.SideButton;
|
||||||
|
|
||||||
@@ -87,18 +86,20 @@ public abstract class GuiBase extends GuiContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mouseX, int mouseY) {
|
protected void drawGuiContainerBackgroundLayer(float renderPartialTicks, int mouseX, int mouseY) {
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
drawBackground(guiLeft, guiTop, mouseX, mouseY);
|
drawBackground(guiLeft, guiTop, mouseX, mouseY);
|
||||||
|
|
||||||
if (scrollbar != null) {
|
if (scrollbar != null) {
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
scrollbar.draw(this);
|
scrollbar.draw(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
mouseX -= guiLeft;
|
mouseX -= guiLeft;
|
||||||
mouseY -= guiTop;
|
mouseY -= guiTop;
|
||||||
@@ -209,7 +210,7 @@ public abstract class GuiBase extends GuiContainer {
|
|||||||
if (text != null) {
|
if (text != null) {
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate(x, y, 1);
|
GlStateManager.translate(x, y, 1);
|
||||||
GL11.glScalef(0.5f, 0.5f, 1);
|
GlStateManager.scale(0.5f, 0.5f, 1);
|
||||||
|
|
||||||
GlStateManager.disableLighting();
|
GlStateManager.disableLighting();
|
||||||
GlStateManager.disableRescaleNormal();
|
GlStateManager.disableRescaleNormal();
|
||||||
@@ -234,9 +235,9 @@ public abstract class GuiBase extends GuiContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawString(int x, int y, String message, int color) {
|
public void drawString(int x, int y, String message, int color) {
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GlStateManager.disableLighting();
|
||||||
fontRendererObj.drawString(message, x, y, color);
|
fontRendererObj.drawString(message, x, y, color);
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GlStateManager.enableLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTooltip(int x, int y, String message) {
|
public void drawTooltip(int x, int y, String message) {
|
||||||
@@ -244,15 +245,15 @@ public abstract class GuiBase extends GuiContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawTooltip(int x, int y, List<String> lines) {
|
public void drawTooltip(int x, int y, List<String> lines) {
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GlStateManager.disableLighting();
|
||||||
drawHoveringText(lines, x, y);
|
drawHoveringText(lines, x, y);
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GlStateManager.enableLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTooltip(int x, int y, ItemStack stack) {
|
public void drawTooltip(int x, int y, ItemStack stack) {
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GlStateManager.disableLighting();
|
||||||
renderToolTip(stack, x, y);
|
renderToolTip(stack, x, y);
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GlStateManager.enableLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTexture(int x, int y, int textureX, int textureY, int width, int height) {
|
public void drawTexture(int x, int y, int textureX, int textureY, int width, int height) {
|
||||||
|
@@ -102,9 +102,7 @@ public class GuiController extends GuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY)) {
|
if (inBounds(barX, barY, barWidth, barHeight, mouseX, mouseY)) {
|
||||||
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:energy_usage", controller.getEnergyUsage())
|
drawTooltip(mouseX, mouseY, t("misc.refinedstorage:energy_usage", controller.getEnergyUsage()) + "\n" + t("misc.refinedstorage:energy_stored", controller.getEnergyStored(null), controller.getMaxEnergyStored(null)));
|
||||||
+ "\n"
|
|
||||||
+ t("misc.refinedstorage:energy_stored", controller.getEnergyStored(null), controller.getMaxEnergyStored(null)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Reference in New Issue
Block a user