rework gui highlighting for terminals
This commit is contained in:
+13
-7
@@ -19,10 +19,8 @@
|
|||||||
package appeng.client.gui.implementations;
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.ActionItems;
|
import appeng.api.config.ActionItems;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
import appeng.client.gui.widgets.GuiCustomSlot;
|
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||||
@@ -89,6 +87,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
private final ArrayList<String> names = new ArrayList<>();
|
private final ArrayList<String> names = new ArrayList<>();
|
||||||
private final ArrayList<Object> lines = new ArrayList<>();
|
private final ArrayList<Object> lines = new ArrayList<>();
|
||||||
private final Set<Object> matchedStacks = new HashSet<>();
|
private final Set<Object> matchedStacks = new HashSet<>();
|
||||||
|
private final Set<ClientDCInternalFluidInv> matchedInterfaces = new HashSet<ClientDCInternalFluidInv>();
|
||||||
|
|
||||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||||
|
|
||||||
@@ -157,12 +156,14 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
|
|
||||||
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
|
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
|
||||||
for (int z = 0; z < 5; z++) {
|
for (int z = 0; z < 5; z++) {
|
||||||
GuiFluidTank tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16);
|
GuiFluidTank tankSlot;
|
||||||
|
if (!matchedInterfaces.contains(inv) && !this.matchedStacks.contains(inv.getInventory().getFluidInSlot(z + (row * 5)))) {
|
||||||
|
tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16, true);
|
||||||
|
} else {
|
||||||
|
tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16);
|
||||||
|
}
|
||||||
this.guiSlots.add(tankSlot);
|
this.guiSlots.add(tankSlot);
|
||||||
guiFluidTankClientDCInternalFluidInvMap.put(tankSlot, inv);
|
guiFluidTankClientDCInternalFluidInvMap.put(tankSlot, inv);
|
||||||
if (this.matchedStacks.contains(inv.getInventory().getFluidInSlot(z + (row * 5)))) {
|
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
offset += 18;
|
offset += 18;
|
||||||
@@ -321,6 +322,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
this.byName.clear();
|
this.byName.clear();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.matchedStacks.clear();
|
this.matchedStacks.clear();
|
||||||
|
this.matchedInterfaces.clear();
|
||||||
|
|
||||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||||
|
|
||||||
@@ -352,8 +354,12 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
|||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (searchFieldInputs.isEmpty() || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
if (found) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+10
-2
@@ -78,6 +78,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
private final ArrayList<String> names = new ArrayList<>();
|
private final ArrayList<String> names = new ArrayList<>();
|
||||||
private final ArrayList<Object> lines = new ArrayList<>();
|
private final ArrayList<Object> lines = new ArrayList<>();
|
||||||
private final Set<Object> matchedStacks = new HashSet<>();
|
private final Set<Object> matchedStacks = new HashSet<>();
|
||||||
|
private final Set<ClientDCInternalInv> matchedInterfaces = new HashSet<>();
|
||||||
|
|
||||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||||
|
|
||||||
@@ -148,7 +149,9 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
for (int z = 0; z < 9; z++) {
|
for (int z = 0; z < 9; z++) {
|
||||||
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
||||||
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
||||||
|
} else if (!matchedInterfaces.contains(inv)) {
|
||||||
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
@@ -325,6 +328,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
this.byName.clear();
|
this.byName.clear();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.matchedStacks.clear();
|
this.matchedStacks.clear();
|
||||||
|
this.matchedInterfaces.clear();
|
||||||
|
|
||||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||||
|
|
||||||
@@ -356,7 +360,11 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
if (searchFieldInputs.isEmpty() || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
private final ArrayList<String> names = new ArrayList<>();
|
private final ArrayList<String> names = new ArrayList<>();
|
||||||
private final ArrayList<Object> lines = new ArrayList<>();
|
private final ArrayList<Object> lines = new ArrayList<>();
|
||||||
private final Set<Object> matchedStacks = new HashSet<>();
|
private final Set<Object> matchedStacks = new HashSet<>();
|
||||||
|
private final Set<ClientDCInternalInv> matchedInterfaces = new HashSet<>();
|
||||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||||
|
|
||||||
private boolean refreshList = false;
|
private boolean refreshList = false;
|
||||||
@@ -155,7 +155,9 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
for (int z = 0; z < 9; z++) {
|
for (int z = 0; z < 9; z++) {
|
||||||
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
||||||
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
||||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
||||||
|
} else if (!matchedInterfaces.contains(inv)) {
|
||||||
|
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
linesDraw++;
|
linesDraw++;
|
||||||
@@ -344,6 +346,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
this.byName.clear();
|
this.byName.clear();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.matchedStacks.clear();
|
this.matchedStacks.clear();
|
||||||
|
this.matchedInterfaces.clear();
|
||||||
|
|
||||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||||
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
|
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
|
||||||
@@ -393,7 +396,13 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if found, filter skipped or machine name matching the search term, add it
|
// if found, filter skipped or machine name matching the search term, add it
|
||||||
if (found || (entry.getName().toLowerCase().contains(searchFieldInputs) && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
if ((searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty()) ||
|
||||||
|
!searchFieldInputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldInputs) ||
|
||||||
|
(!searchFieldOutputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
||||||
|
this.matchedInterfaces.add(entry);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
|
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
|
||||||
this.byName.put(entry.getName(), entry);
|
this.byName.put(entry.getName(), entry);
|
||||||
cachedSearch.add(entry);
|
cachedSearch.add(entry);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
|||||||
private final int slot;
|
private final int slot;
|
||||||
private final int width;
|
private final int width;
|
||||||
private final int height;
|
private final int height;
|
||||||
|
private boolean darkened = false;
|
||||||
|
|
||||||
public GuiFluidTank(IAEFluidTank tank, int slot, int id, int x, int y, int w, int h) {
|
public GuiFluidTank(IAEFluidTank tank, int slot, int id, int x, int y, int w, int h) {
|
||||||
super(id, x, y);
|
super(id, x, y);
|
||||||
@@ -50,6 +51,15 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
|||||||
this.height = h;
|
this.height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GuiFluidTank(IAEFluidTank tank, int slot, int id, int x, int y, int w, int h, boolean darkened) {
|
||||||
|
super(id, x, y);
|
||||||
|
this.tank = tank;
|
||||||
|
this.slot = slot;
|
||||||
|
this.width = w;
|
||||||
|
this.height = h;
|
||||||
|
this.darkened = darkened;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawContent(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
public void drawContent(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||||
final IAEFluidStack fs = this.getFluidStack();
|
final IAEFluidStack fs = this.getFluidStack();
|
||||||
@@ -66,6 +76,11 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
|||||||
float red = (fluid.getFluid().getColor() >> 16 & 255) / 255.0F;
|
float red = (fluid.getFluid().getColor() >> 16 & 255) / 255.0F;
|
||||||
float green = (fluid.getFluid().getColor() >> 8 & 255) / 255.0F;
|
float green = (fluid.getFluid().getColor() >> 8 & 255) / 255.0F;
|
||||||
float blue = (fluid.getFluid().getColor() & 255) / 255.0F;
|
float blue = (fluid.getFluid().getColor() & 255) / 255.0F;
|
||||||
|
if (darkened) {
|
||||||
|
red = red * 0.4F;
|
||||||
|
green = green * 0.4F;
|
||||||
|
blue = blue * 0.4F;
|
||||||
|
}
|
||||||
GlStateManager.color(red, green, blue);
|
GlStateManager.color(red, green, blue);
|
||||||
|
|
||||||
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite(fluid.getFluid().getStill().toString());
|
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite(fluid.getFluid().getStill().toString());
|
||||||
|
|||||||
Reference in New Issue
Block a user