mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 03:25:07 +00:00
Gui rendering cleanup
This commit is contained in:
1 parent
17f036522e
commit
31a305ffc2
173 files changed
+1317
-1349
No files matched your search
@@ -1,17 +1,15 @@
|
||||
package binnie.craftgui.minecraft.control;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
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.CraftGUIUtil;
|
||||
import binnie.craftgui.core.geometry.IPoint;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ControlItemDisplay extends Control implements ITooltip {
|
||||
private ItemStack itemStack;
|
||||
@@ -23,19 +21,19 @@ public class ControlItemDisplay extends Control implements ITooltip {
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
public ControlItemDisplay(final IWidget parent, final float x, final float y) {
|
||||
this(parent, x, y, 16.0f);
|
||||
public ControlItemDisplay(final IWidget parent, final int x, final int y) {
|
||||
this(parent, x, y, 16);
|
||||
}
|
||||
|
||||
public ControlItemDisplay(final IWidget parent, final float f, final float y, final ItemStack stack, final boolean tooltip) {
|
||||
this(parent, f, y, 16.0f);
|
||||
public ControlItemDisplay(final IWidget parent, final int f, final int y, final ItemStack stack, final boolean tooltip) {
|
||||
this(parent, f, y, 16);
|
||||
this.setItemStack(stack);
|
||||
if (tooltip) {
|
||||
this.setTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
public ControlItemDisplay(final IWidget parent, final float x, final float y, final float size) {
|
||||
public ControlItemDisplay(final IWidget parent, final int x, final int y, final int size) {
|
||||
super(parent, x, y, size, size);
|
||||
this.itemStack = null;
|
||||
this.hastooltip = false;
|
||||
@@ -43,25 +41,26 @@ public class ControlItemDisplay extends Control implements ITooltip {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getSuperParent().getPosition());
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100.0f || relativeToWindow.y() > Window.get(this).getSize().y() + 100.0f) {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (this.itemStack == null) {
|
||||
return;
|
||||
}
|
||||
if (this.itemStack != null) {
|
||||
|
||||
if (this.getSize().x() != 16.0f) {
|
||||
GL11.glPushMatrix();
|
||||
final float scale = this.getSize().x() / 16.0f;
|
||||
GL11.glScalef(scale, scale, 1.0f);
|
||||
BinnieCore.proxy.getMinecraftInstance();
|
||||
final float phase = Minecraft.getSystemTime() / 20.0f;
|
||||
CraftGUI.render.item(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
CraftGUI.render.item(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
}
|
||||
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getSuperParent().getPosition());
|
||||
if (relativeToWindow.x() > Window.get(this).getSize().x() + 100 || relativeToWindow.y() > Window.get(this).getSize().y() + 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.getSize().x() != 16) {
|
||||
GlStateManager.pushMatrix();
|
||||
final float scale = this.getSize().x() / 16.0f;
|
||||
GlStateManager.scale(scale, scale, 1);
|
||||
CraftGUIUtil.renderItem(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
GlStateManager.popMatrix();
|
||||
} else {
|
||||
CraftGUIUtil.renderItem(IPoint.ZERO, this.itemStack, this.rotating);
|
||||
}
|
||||
GlStateManager.enableAlpha();
|
||||
}
|
||||
|
||||
public void setItemStack(final ItemStack itemStack) {
|
||||
|
||||
Reference in new issue
Block a user