mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 04:09:43 +00:00
Even more additions to the IO GUI.
This commit is contained in:
1 parent
f8617a2248
commit
26feb5e646
7 files changed
+95
-8
No files matched your search
@@ -4,19 +4,28 @@ import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.gui.IconButtonEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.gui.IoConfigRenderer.SelectedFace;
|
||||
import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.gui.GuiContainerBase;
|
||||
import crazypants.gui.GuiToolTip;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.vecmath.Vector4f;
|
||||
|
||||
public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
|
||||
|
||||
public static final Vector4f PUSH_COLOR = new Vector4f(0.8f,0.4f,0.1f,0.5f);
|
||||
public static final Vector4f PULL_COLOR = new Vector4f(0.1f,0.4f,0.8f,0.5f);
|
||||
|
||||
|
||||
protected static final int POWER_Y = 14;
|
||||
protected final int POWER_X = 15;
|
||||
protected static final int POWER_WIDTH = 10;
|
||||
@@ -26,6 +35,7 @@ public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
public static final int BUTTON_SIZE = 16;
|
||||
private static final int CONFIG_ID = 8962349;
|
||||
|
||||
|
||||
private AbstractMachineEntity tileEntity;
|
||||
|
||||
private RedstoneModeButton redstoneButton;
|
||||
@@ -67,6 +77,32 @@ public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
addOverlay(configOverlay);
|
||||
}
|
||||
|
||||
|
||||
public void renderSlotHighlights(IoMode mode) {
|
||||
SlotDefinition slotDef = tileEntity.getSlotDefinition();
|
||||
if(slotDef.getNumInputSlots() > 0 && (mode == IoMode.PULL || mode == IoMode.PUSH_PULL)) {
|
||||
for (int slot = slotDef.getMinInputSlot(); slot <= slotDef.getMaxInputSlot(); slot++) {
|
||||
renderSlotHighlight(slot,PULL_COLOR);
|
||||
}
|
||||
}
|
||||
if(slotDef.getNumOutputSlots() > 0 && (mode == IoMode.PUSH || mode == IoMode.PUSH_PULL)) {
|
||||
for (int slot = slotDef.getMinOutputSlot(); slot <= slotDef.getMaxOutputSlot(); slot++) {
|
||||
renderSlotHighlight(slot,PUSH_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderSlotHighlight(int slot, Vector4f col) {
|
||||
Slot invSlot = (Slot)inventorySlots.inventorySlots.get(slot);
|
||||
renderSlotHighlight(col, invSlot.xDisplayPosition,invSlot.yDisplayPosition,16,16);
|
||||
}
|
||||
|
||||
protected void renderSlotHighlight(Vector4f col, int x, int y, int width, int height) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
RenderUtil.renderQuad2D(getGuiLeft() + x, getGuiTop() + y, 0, width, height, col);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
protected int getPowerX() {
|
||||
return POWER_X;
|
||||
}
|
||||
@@ -113,8 +149,15 @@ public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
guibutton.drawButton(this.mc, 0, 0);
|
||||
}
|
||||
|
||||
SelectedFace sel = configOverlay.getSelection();
|
||||
if(sel != null) {
|
||||
IoMode mode = sel.config.getIoMode(sel.face);
|
||||
if(mode != null) {
|
||||
renderSlotHighlights(mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.util.IIcon;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.gui.IGuiOverlay;
|
||||
import crazypants.enderio.gui.IoConfigRenderer;
|
||||
import crazypants.enderio.gui.IoConfigRenderer.SelectedFace;
|
||||
import crazypants.gui.IGuiScreen;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
@@ -97,6 +98,9 @@ public class GuiOverlayIoConfig implements IGuiOverlay {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
public SelectedFace getSelection() {
|
||||
return renderer.getSelection();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ContainerAlloySmelter extends AbstractMachineContainer {
|
||||
return tileEntity.isItemValidForSlot(0, itemStack);
|
||||
}
|
||||
});
|
||||
addSlotToContainer(new Slot(tileEntity, 1, 78, 7) {
|
||||
addSlotToContainer(new Slot(tileEntity, 1, 79, 7) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
return tileEntity.isItemValidForSlot(1, itemStack);
|
||||
|
||||
@@ -15,6 +15,7 @@ import crazypants.gui.GuiToolTip;
|
||||
import crazypants.gui.IconButton;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.vecmath.Vector4f;
|
||||
|
||||
public class GuiAlloySmelter extends GuiMachineBase {
|
||||
|
||||
@@ -65,6 +66,15 @@ public class GuiAlloySmelter extends GuiMachineBase {
|
||||
buttonList.add(vanillaFurnaceButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderSlotHighlight(int slot, Vector4f col) {
|
||||
if(tileEntity.getSlotDefinition().isOutputSlot(slot)) {
|
||||
renderSlotHighlight(col, 75,54,24,24);
|
||||
} else {
|
||||
super.renderSlotHighlight(slot, col);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id == SMELT_MODE_BUTTON_ID) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.fluid.Fluids;
|
||||
import crazypants.enderio.machine.GuiMachineBase;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.gui.GuiToolTip;
|
||||
import crazypants.render.ColorUtil;
|
||||
@@ -58,6 +59,22 @@ public class GuiCombustionGenerator extends GuiMachineBase {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSlotHighlights(IoMode mode) {
|
||||
super.renderSlotHighlights(mode);
|
||||
|
||||
if(mode == IoMode.PULL || mode == IoMode.PUSH_PULL) {
|
||||
int x = 48 - 2;
|
||||
int y = 21 - 2;
|
||||
int w = 15 + 4;
|
||||
int h = 47 + 4;
|
||||
renderSlotHighlight(PULL_COLOR,x,y,w,h);
|
||||
x = 114 - 2;
|
||||
renderSlotHighlight(PULL_COLOR,x,y,w,h);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@@ -2,18 +2,15 @@ package crazypants.enderio.machine.still;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.fluid.Fluids;
|
||||
import crazypants.enderio.machine.GuiMachineBase;
|
||||
import crazypants.enderio.machine.IMachineRecipe.ResultStack;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
import crazypants.gui.GuiToolTip;
|
||||
import crazypants.render.RenderUtil;
|
||||
@@ -61,6 +58,22 @@ public class GuiVat extends GuiMachineBase {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSlotHighlights(IoMode mode) {
|
||||
super.renderSlotHighlights(mode);
|
||||
|
||||
int x = 30;
|
||||
int y = 12;
|
||||
if(mode == IoMode.PULL || mode == IoMode.PUSH_PULL) {
|
||||
renderSlotHighlight(PULL_COLOR,x-2,y-2,15+4,47+4);
|
||||
}
|
||||
if(mode == IoMode.PUSH || mode == IoMode.PUSH_PULL) {
|
||||
x = 132;
|
||||
renderSlotHighlight(PUSH_COLOR,x-2,y-2,15+4,47+4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the
|
||||
* items)
|
||||
@@ -128,7 +141,7 @@ public class GuiVat extends GuiMachineBase {
|
||||
drawTexturedModalRect(x, y, 0, 256 - 28, 26, 28);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected int getPowerX() {
|
||||
return 10;
|
||||
|
||||
Reference in new issue
Block a user