mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 17:44:46 +00:00
Fix filters
Add oredictionary filter Fix inconsistent with WCT Gui improvements Filter caching GuiFCImgButton 3/4 size support
This commit is contained in:
1 parent
083c135874
commit
bb912ec8a1
14 files changed
+310
-232
No files matched your search
@@ -22,6 +22,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
private static Map<EnumPair, ButtonAppearance> appearances;
|
||||
private final String buttonSetting;
|
||||
private boolean halfSize = false;
|
||||
private boolean threeFourths = false;
|
||||
private String fillVar;
|
||||
private String currentValue;
|
||||
private final boolean background;
|
||||
@@ -145,6 +146,14 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
this.halfSize = halfSize;
|
||||
}
|
||||
|
||||
public boolean isThreeFourths() {
|
||||
return threeFourths;
|
||||
}
|
||||
|
||||
public void setThreeFourths(boolean threeFourths) {
|
||||
this.threeFourths = threeFourths;
|
||||
}
|
||||
|
||||
public String getFillVar() {
|
||||
return this.fillVar;
|
||||
}
|
||||
@@ -165,12 +174,12 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return this.halfSize ? 8 : 16;
|
||||
return this.halfSize ? 8 : threeFourths ? 12 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return this.halfSize ? 8 : 16;
|
||||
return this.halfSize ? 8 : threeFourths ? 12 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,79 +236,44 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
if (this.visible) {
|
||||
final int iconIndex = this.getIconIndex();
|
||||
final int iconPage = this.getIconPage();
|
||||
this.width = getWidth();
|
||||
this.height = getHeight();
|
||||
float scaleFactor = halfSize ? 3 : threeFourths ? 4.5f : 6;
|
||||
|
||||
if (this.halfSize) {
|
||||
this.width = 8;
|
||||
this.height = 8;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * 3, 0.5f / 16 * 3, 0.5f / 16 * 3);
|
||||
|
||||
if (this.enabled) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
} else {
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
if (this.background) {
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
}
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(uv_x * 16F * 16F / 3F),
|
||||
Math.round(uv_y * 16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * scaleFactor, 0.5f / 16 * scaleFactor, 0.5f / 16 * scaleFactor);
|
||||
|
||||
if (this.enabled) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * 6, 0.5f / 16 * 6, 0.5f / 16 * 6);
|
||||
if (this.enabled) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
} else {
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
if (this.background) {
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
}
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
if (this.background) {
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(uv_x * 16F * 16F / 3F),
|
||||
Math.round(uv_y * 16F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
}
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(uv_x * 16F * 16F / 3F),
|
||||
Math.round(uv_y * 16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
|
||||
this.mouseDragged(par1Minecraft, par2, par3);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerMagnetFilter;
|
||||
import com.glodblock.github.client.gui.widget.FCGuiBaseButton;
|
||||
@@ -20,6 +22,7 @@ import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
|
||||
public class GuiMagnetFilter extends AEBaseMEGui {
|
||||
|
||||
@@ -27,7 +30,8 @@ public class GuiMagnetFilter extends AEBaseMEGui {
|
||||
protected ContainerMagnetFilter cont;
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/magnet_filter.png");
|
||||
|
||||
protected Component components[] = new Component[3];
|
||||
protected Component[] components = new Component[4];
|
||||
protected MEGuiTextField oreDict;
|
||||
protected GuiTabButton originalGuiBtn;
|
||||
protected GuiImgButton clearBtn;
|
||||
|
||||
@@ -36,13 +40,14 @@ public class GuiMagnetFilter extends AEBaseMEGui {
|
||||
this.xSize = 195;
|
||||
this.ySize = 214;
|
||||
this.cont = (ContainerMagnetFilter) this.inventorySlots;
|
||||
oreDict = new MEGuiTextField(149, 12, NameConst.i18n(NameConst.TT_MAGNET_CARD_OREDICT));
|
||||
}
|
||||
|
||||
private class Component {
|
||||
|
||||
private GuiFCImgButton enable;
|
||||
private GuiFCImgButton disable;
|
||||
private String action;
|
||||
private final GuiFCImgButton enable;
|
||||
private final GuiFCImgButton disable;
|
||||
private final String action;
|
||||
private boolean var;
|
||||
|
||||
public Component(int x, int y, boolean var, String action) {
|
||||
@@ -50,6 +55,8 @@ public class GuiMagnetFilter extends AEBaseMEGui {
|
||||
this.disable = new GuiFCImgButton(x, y, "DISABLE_12x", "DISABLE", false);
|
||||
this.var = var;
|
||||
this.action = action;
|
||||
enable.setThreeFourths(true);
|
||||
disable.setThreeFourths(true);
|
||||
buttonList.add(this.enable);
|
||||
buttonList.add(this.disable);
|
||||
}
|
||||
@@ -98,20 +105,29 @@ public class GuiMagnetFilter extends AEBaseMEGui {
|
||||
? NameConst.GUI_MAGNET_CARD_WhiteList
|
||||
: NameConst.GUI_MAGNET_CARD_BlackList)));
|
||||
this.components[0] = new Component(
|
||||
this.guiLeft + 156,
|
||||
this.guiLeft + 157,
|
||||
this.guiTop + 18,
|
||||
this.cont.nbt,
|
||||
"WirelessTerminal.magnet.NBT");
|
||||
this.components[1] = new Component(
|
||||
this.guiLeft + 156,
|
||||
this.guiLeft + 157,
|
||||
this.guiTop + 31,
|
||||
this.cont.meta,
|
||||
"WirelessTerminal.magnet.Meta");
|
||||
this.components[2] = new Component(
|
||||
this.guiLeft + 156,
|
||||
this.guiLeft + 157,
|
||||
this.guiTop + 44,
|
||||
this.cont.ore,
|
||||
"WirelessTerminal.magnet.Ore");
|
||||
this.components[3] = new Component(
|
||||
this.guiLeft + 157,
|
||||
this.guiTop + 112,
|
||||
this.cont.oreDict,
|
||||
"WirelessTerminal.magnet.OreDictState");
|
||||
|
||||
oreDict.x = this.guiLeft + 7;
|
||||
oreDict.y = this.guiTop + 112;
|
||||
oreDict.setText(this.cont.oreDictFilter);
|
||||
|
||||
this.buttonList.add(
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
@@ -122,23 +138,27 @@ public class GuiMagnetFilter extends AEBaseMEGui {
|
||||
itemRender));
|
||||
this.originalGuiBtn.setHideEdge(13); // GuiTabButton implementation //
|
||||
|
||||
this.clearBtn = new GuiImgButton(this.guiLeft + 8, this.guiTop + 48, Settings.ACTIONS, ActionItems.CLOSE);
|
||||
this.clearBtn = new GuiImgButton(this.guiLeft + 7, this.guiTop + 48, Settings.ACTIONS, ActionItems.CLOSE);
|
||||
this.clearBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.clearBtn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float btn) {
|
||||
handleTooltip(mouseX, mouseY, oreDict);
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.fontRendererObj.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD)), 8, 6, 0x404040);
|
||||
this.fontRendererObj
|
||||
.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_NBT)), 61, 22, 0x404040);
|
||||
this.fontRendererObj
|
||||
.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_META)), 61, 34, 0x404040);
|
||||
this.fontRendererObj
|
||||
.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE)), 61, 46, 0x404040);
|
||||
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD), 8, 6, 0x404040);
|
||||
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_NBT), 61, 22, 0x404040);
|
||||
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_META), 61, 34, 0x404040);
|
||||
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE), 61, 46, 0x404040);
|
||||
this.components[0].setVar(this.cont.nbt);
|
||||
this.components[1].setVar(this.cont.meta);
|
||||
this.components[2].setVar(this.cont.ore);
|
||||
this.components[3].setVar(this.cont.oreDict);
|
||||
for (Component c : components) {
|
||||
c.draw();
|
||||
}
|
||||
@@ -149,8 +169,25 @@ public class GuiMagnetFilter extends AEBaseMEGui {
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
|
||||
oreDict.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if (oreDict.isFocused() && (Keyboard.KEY_NUMPADENTER == keyCode || Keyboard.KEY_RETURN == keyCode)) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns("WirelessTerminal.magnet.OreDictFilter", oreDict.getText()));
|
||||
}
|
||||
|
||||
if (!oreDict.textboxKeyTyped(typedChar, keyCode)) super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
oreDict.mouseClicked(xCoord, yCoord, btn);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.util.Platform;
|
||||
@@ -32,13 +33,21 @@ public class ContainerMagnetFilter extends FCBaseContainer implements IOptionalS
|
||||
|
||||
@GuiSync(104)
|
||||
public boolean ore;
|
||||
protected SlotFake[] filterSlots;
|
||||
|
||||
@GuiSync(105)
|
||||
public boolean oreDict;
|
||||
|
||||
@GuiSync(106)
|
||||
public String oreDictFilter;
|
||||
|
||||
protected OptionalSlotFake[] filterSlots;
|
||||
protected final IInventory filter;
|
||||
|
||||
public ContainerMagnetFilter(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
this.filter = ((IItemTerminal) monitorable).getInventoryByName("config");
|
||||
this.filterSlots = new SlotFake[27];
|
||||
this.filterSlots = new OptionalSlotFake[27];
|
||||
oreDictFilter = ((IWirelessMagnetFilter) getHost()).getOreDictFilter();
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(
|
||||
@@ -51,6 +60,7 @@ public class ContainerMagnetFilter extends FCBaseContainer implements IOptionalS
|
||||
0,
|
||||
0,
|
||||
1));
|
||||
this.filterSlots[x + y * 9].setRenderDisabled(false);
|
||||
}
|
||||
}
|
||||
bindPlayerInventory(ip, 0, 126);
|
||||
@@ -84,6 +94,8 @@ public class ContainerMagnetFilter extends FCBaseContainer implements IOptionalS
|
||||
this.meta = host.getMetaMode();
|
||||
this.nbt = host.getNBTMode();
|
||||
this.ore = host.getOreMode();
|
||||
this.oreDict = host.getOreDictMode();
|
||||
this.oreDictFilter = host.getOreDictFilter();
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user