Gui rendering cleanup

This commit is contained in:
mezz committed 2017-01-24 20:53:27 -08:00
1 parent 17f036522e
commit 31a305ffc2
173 files changed
+1317 -1349

No files matched your search

@@ -5,6 +5,7 @@ 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.minecraft.Window;
@@ -24,34 +25,34 @@ public class ControlBreweryProgress extends ControlProgressBase {
static Texture BreweryOverlay = new StandardTexture(34, 69, 34, 39, ExtraTreeTexture.Gui);
@Override
public void onRenderBackground() {
CraftGUI.render.texture(ControlBreweryProgress.Brewery, new IPoint(0.0f, 0.0f));
public void onRenderBackground(int guiWidth, int guiHeight) {
CraftGUI.render.texture(ControlBreweryProgress.Brewery, IPoint.ZERO);
final BreweryLogic logic = Machine.getInterface(BreweryLogic.class, Window.get(this).getInventory());
if (logic == null || logic.currentCrafting == null || logic.currentCrafting.inputFluid == null) {
return;
}
final int fermentedHeight = (int) (32.0f * logic.getProgress() / 100.0f);
CraftGUI.render.limitArea(new IArea(new IPoint(1.0f, 6.0f).add(this.getAbsolutePosition()), new IPoint(32.0f, 32 - fermentedHeight)));
GL11.glEnable(3089);
CraftGUI.render.fluid(new IPoint(1.0f, 6.0f), logic.currentCrafting.inputFluid);
CraftGUI.render.fluid(new IPoint(17.0f, 6.0f), logic.currentCrafting.inputFluid);
CraftGUI.render.fluid(new IPoint(1.0f, 22.0f), logic.currentCrafting.inputFluid);
CraftGUI.render.fluid(new IPoint(17.0f, 22.0f), logic.currentCrafting.inputFluid);
GL11.glDisable(3089);
CraftGUI.render.limitArea(new IArea(new IPoint(1.0f, 38 - fermentedHeight).add(this.getAbsolutePosition()), new IPoint(32.0f, fermentedHeight)));
GL11.glEnable(3089);
CraftGUI.render.fluid(new IPoint(1.0f, 6.0f), BreweryRecipes.getOutput(logic.currentCrafting));
CraftGUI.render.fluid(new IPoint(17.0f, 6.0f), BreweryRecipes.getOutput(logic.currentCrafting));
CraftGUI.render.fluid(new IPoint(1.0f, 22.0f), BreweryRecipes.getOutput(logic.currentCrafting));
CraftGUI.render.fluid(new IPoint(17.0f, 22.0f), BreweryRecipes.getOutput(logic.currentCrafting));
GL11.glDisable(3089);
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);
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));
GL11.glDisable(GL11.GL_SCISSOR_TEST);
final ItemStackSet stacks = new ItemStackSet();
Collections.addAll(stacks, logic.currentCrafting.inputGrains);
stacks.add(logic.currentCrafting.ingredient);
int x = 1;
int y = 6;
for (final ItemStack stack : stacks) {
CraftGUI.render.item(new IPoint(x, y), stack);
CraftGUIUtil.renderItem(new IPoint(x, y), stack);
x += 16;
if (x > 18) {
x = 1;
@@ -61,11 +62,11 @@ public class ControlBreweryProgress extends ControlProgressBase {
}
@Override
public void onRenderForeground() {
public void onRenderForeground(int guiWidth, int guiHeight) {
}
protected ControlBreweryProgress(final IWidget parent, final float x, final float y) {
super(parent, x, y, 34.0f, 39.0f);
protected ControlBreweryProgress(final IWidget parent, final int x, final int y) {
super(parent, x, y, 34, 39);
this.addAttribute(Attribute.MouseOver);
}