mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-17 02:55:13 +00:00
Fix wrong OpenGL in item draw method
This commit is contained in:
1 parent
2475710a6a
commit
fac2008f14
6 files changed
+29
-41
No files matched your search
@@ -36,10 +36,11 @@ public class ItemMetadataRenderer implements IItemRenderer {
|
||||
if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslated(0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY && block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(3042);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
((RenderBlocks) data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0f);
|
||||
|
||||
@@ -15,11 +15,11 @@ public class MultipassItemRenderer implements IItemRenderer {
|
||||
GL11.glEnable(3008);
|
||||
if (block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(3042);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
} else {
|
||||
GL11.glAlphaFunc(516, 0.5f);
|
||||
GL11.glDisable(3042);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
MultipassBlockRenderer.instance.renderInventoryBlock(block, TileEntityMetadata.getItemDamage(item), 0, renderer);
|
||||
|
||||
@@ -285,9 +285,6 @@ public class Widget implements IWidget {
|
||||
|
||||
for (IWidget widget : getWidgets()) {
|
||||
widget.render();
|
||||
}
|
||||
|
||||
for (IWidget widget : getWidgets()) {
|
||||
CraftGUI.render.preRender(widget);
|
||||
widget.onRender(RenderStage.PostSiblings);
|
||||
CraftGUI.render.postRender(widget);
|
||||
@@ -419,11 +416,9 @@ public class Widget implements IWidget {
|
||||
public void onRender(RenderStage stage) {
|
||||
if (stage == RenderStage.PreChildren) {
|
||||
onRenderBackground();
|
||||
}
|
||||
if (stage == RenderStage.PostChildren) {
|
||||
} else if (stage == RenderStage.PostChildren) {
|
||||
onRenderForeground();
|
||||
}
|
||||
if (stage == RenderStage.PostSiblings) {
|
||||
} else if (stage == RenderStage.PostSiblings) {
|
||||
onRenderOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package binnie.core.craftgui.minecraft;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.events.EventKey;
|
||||
@@ -93,8 +92,8 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
InventoryPlayer playerInventory = mc.thePlayer.inventory;
|
||||
draggedItem = playerInventory.getItemStack();
|
||||
if (draggedItem != null) {
|
||||
renderItem(new IPoint(mouseX - 8, mouseY - 8), draggedItem, 200, false);
|
||||
renderItem(new IPoint(mouseX - 8, mouseY - 8), draggedItem, 200, false);
|
||||
renderItem(new IPoint(mouseX - 8, mouseY - 8), draggedItem, false);
|
||||
renderItem(new IPoint(mouseX - 8, mouseY - 8), draggedItem, false);
|
||||
}
|
||||
GL11.glDisable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glPopMatrix();
|
||||
@@ -371,14 +370,9 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
}
|
||||
|
||||
public void renderItem(IPoint pos, ItemStack item, boolean rotating) {
|
||||
renderItem(pos, item, (int) zLevel + 3, rotating);
|
||||
}
|
||||
|
||||
private void renderItem(IPoint pos, ItemStack item, int zLevel, boolean rotating) {
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(8256);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
FontRenderer font = item.getItem().getFontRenderer(item);
|
||||
if (font == null) {
|
||||
@@ -387,23 +381,23 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
|
||||
BinnieCore.proxy.getMinecraftInstance();
|
||||
float phase = Minecraft.getSystemTime() / 20.0f;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (rotating) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(8.0f, 8.0f, 0.0f);
|
||||
GL11.glRotatef(phase, 0.0f, -0.866f, 0.5f);
|
||||
GL11.glTranslatef(-8.0f, -8.0f, -67.1f);
|
||||
}
|
||||
|
||||
GuiScreen.itemRender.renderItemAndEffectIntoGUI(font, mc.renderEngine, item, (int) pos.x(), (int) pos.y());
|
||||
GL11.glPopMatrix();
|
||||
if (rotating) {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GuiScreen.itemRender.renderItemOverlayIntoGUI(font, mc.renderEngine, item, (int) pos.x(), (int) pos.y(), null);
|
||||
GL11.glClear(256);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
CraftGUI.render.color(0xffffffff);
|
||||
GL11.glEnable(32826); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
public void renderIcon(IPoint pos, IIcon icon, ResourceLocation map) {
|
||||
@@ -466,8 +460,8 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
float b = (color & 0xFF) / 255.0f;
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GL11.glColor4f(r, g, b, alpha);
|
||||
tessellator.startDrawingQuads();
|
||||
@@ -477,7 +471,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
tessellator.addVertex(x, y, 0.0);
|
||||
tessellator.draw();
|
||||
GL11.glColor4f(1, 1, 1, 255);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,6 @@ public class Renderer {
|
||||
|
||||
if (a > 0 && a != 255) {
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
} else {
|
||||
GL11.glColor3f(r / 255.0f, g / 255.0f, b / 255.0f);
|
||||
}
|
||||
|
||||
@@ -8,13 +8,12 @@ import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
public boolean hastooltip;
|
||||
public boolean hasTooltip;
|
||||
|
||||
protected FluidStack itemStack;
|
||||
|
||||
@@ -33,11 +32,11 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
public ControlFluidDisplay(IWidget parent, float x, float y, float size) {
|
||||
super(parent, x, y, size, size);
|
||||
itemStack = null;
|
||||
hastooltip = false;
|
||||
hasTooltip = false;
|
||||
}
|
||||
|
||||
public void setTooltip() {
|
||||
hastooltip = true;
|
||||
hasTooltip = true;
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
}
|
||||
|
||||
@@ -59,10 +58,9 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = hex & 0xFF;
|
||||
IIcon icon = itemStack.getFluid().getIcon(itemStack);
|
||||
GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (getSize().x() != 16.0f) {
|
||||
GL11.glPushMatrix();
|
||||
@@ -73,7 +71,8 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
} else {
|
||||
CraftGUI.render.iconBlock(IPoint.ZERO, itemStack.getFluid().getIcon(itemStack));
|
||||
}
|
||||
GL11.glDisable(3042);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1, 1, 1, 1.0f);
|
||||
}
|
||||
|
||||
public void setItemStack(FluidStack itemStack) {
|
||||
@@ -82,7 +81,7 @@ public class ControlFluidDisplay extends Control implements ITooltip {
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (hastooltip && itemStack != null) {
|
||||
if (hasTooltip && itemStack != null) {
|
||||
tooltip.add(itemStack.getLocalizedName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user