mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-17 11:05:32 +00:00
Some refactoring and code improvement
This commit is contained in:
1 parent
2475710a6a
commit
4e9624daab
4 files changed
+16
-21
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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