mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-22 12:59:40 +00:00
hold the shift to stop sort items (#188)
Co-authored-by: zy <[email protected]>
This commit is contained in:
1 parent
6187a7306d
commit
0bf904f2a4
4 files changed
+60
-29
No files matched your search
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
dependencies {
|
dependencies {
|
||||||
api('com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev')
|
api('com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev')
|
||||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-306-GTNH:dev')
|
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-307-GTNH:dev')
|
||||||
api('curse.maven:cofh-core-69162:2388751')
|
api('curse.maven:cofh-core-69162:2388751')
|
||||||
api('com.github.GTNewHorizons:waila:1.6.5:dev')
|
api('com.github.GTNewHorizons:waila:1.6.5:dev')
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
|||||||
protected GuiImgButton terminalStyleBox;
|
protected GuiImgButton terminalStyleBox;
|
||||||
protected GuiImgButton searchStringSave;
|
protected GuiImgButton searchStringSave;
|
||||||
protected GuiImgButton typeFilter;
|
protected GuiImgButton typeFilter;
|
||||||
|
protected boolean hasShiftKeyDown = false;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
|
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
|
||||||
@@ -772,4 +773,14 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
|||||||
public boolean isOverTextField(int mousex, int mousey) {
|
public boolean isOverTextField(int mousex, int mousey) {
|
||||||
return searchField.isMouseIn(mousex, mousey);
|
return searchField.isMouseIn(mousex, mousey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleKeyboardInput() {
|
||||||
|
super.handleKeyboardInput();
|
||||||
|
hasShiftKeyDown |= isShiftKeyDown();
|
||||||
|
if (hasShiftKeyDown && !Keyboard.getEventKeyState()) { // keyup
|
||||||
|
this.repo.updateView();
|
||||||
|
hasShiftKeyDown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ public class EssentiaRepo extends FluidRepo {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateView() {
|
public void updateView() {
|
||||||
this.view.clear();
|
if (needUpdateView()) this.view.clear();
|
||||||
this.dsp.clear();
|
this.dsp.clear();
|
||||||
|
|
||||||
this.view.ensureCapacity(this.list.size());
|
this.view.ensureCapacity(this.list.size());
|
||||||
@@ -58,7 +58,7 @@ public class EssentiaRepo extends FluidRepo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IAEItemStack is : this.list) {
|
for (IAEItemStack is : needUpdateView() ? this.list : this.cache) {
|
||||||
if (this.myPartitionList != null) {
|
if (this.myPartitionList != null) {
|
||||||
if (!this.myPartitionList.isListed(is)) {
|
if (!this.myPartitionList.isListed(is)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -87,26 +87,30 @@ public class EssentiaRepo extends FluidRepo {
|
|||||||
this.view.add(is);
|
this.view.add(is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (needUpdateView()) {
|
||||||
|
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||||
|
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||||
|
|
||||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
FluidSorters.init();
|
||||||
|
|
||||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
if (SortBy == SortOrder.MOD) {
|
||||||
FluidSorters.init();
|
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||||
|
} else if (SortBy == SortOrder.AMOUNT) {
|
||||||
if (SortBy == SortOrder.MOD) {
|
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||||
} else if (SortBy == SortOrder.AMOUNT) {
|
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
} else {
|
||||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
}
|
||||||
} else {
|
} else {
|
||||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
this.cache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final IAEItemStack is : this.view) {
|
for (final IAEItemStack is : this.view) {
|
||||||
this.dsp.add(is.getItemStack());
|
this.dsp.add(is.getItemStack());
|
||||||
}
|
}
|
||||||
|
this.lastSearchString = this.searchString;
|
||||||
Iterator<IAEItemStack> it1 = this.view.iterator();
|
Iterator<IAEItemStack> it1 = this.view.iterator();
|
||||||
while (it1.hasNext()) {
|
while (it1.hasNext()) {
|
||||||
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
|
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
package com.glodblock.github.client.me;
|
package com.glodblock.github.client.me;
|
||||||
|
|
||||||
|
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -45,12 +47,14 @@ public class FluidRepo implements IDisplayRepo {
|
|||||||
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||||
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
|
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||||
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
|
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
|
||||||
|
protected final ArrayList<IAEItemStack> cache = new ArrayList<>();
|
||||||
protected final IScrollSource src;
|
protected final IScrollSource src;
|
||||||
protected final ISortSource sortSrc;
|
protected final ISortSource sortSrc;
|
||||||
|
|
||||||
protected int rowSize = 9;
|
protected int rowSize = 9;
|
||||||
|
|
||||||
protected String searchString = "";
|
protected String searchString = "";
|
||||||
|
protected String lastSearchString = "";
|
||||||
protected IPartitionList<IAEItemStack> myPartitionList;
|
protected IPartitionList<IAEItemStack> myPartitionList;
|
||||||
private String NEIWord = null;
|
private String NEIWord = null;
|
||||||
private boolean hasPower;
|
private boolean hasPower;
|
||||||
@@ -86,11 +90,19 @@ public class FluidRepo implements IDisplayRepo {
|
|||||||
if (st != null) {
|
if (st != null) {
|
||||||
st.reset();
|
st.reset();
|
||||||
st.add(is);
|
st.add(is);
|
||||||
|
if (isShiftKeyDown() && this.view.contains(st)) {
|
||||||
|
this.view.get(this.view.indexOf(st)).setStackSize(st.getStackSize());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (isShiftKeyDown()) this.cache.add(is);
|
||||||
this.list.add(is);
|
this.list.add(is);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean needUpdateView() {
|
||||||
|
return !isShiftKeyDown() || !this.lastSearchString.equals(this.searchString);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setViewCell(final ItemStack[] list) {
|
public void setViewCell(final ItemStack[] list) {
|
||||||
this.myPartitionList = ItemViewCell.createFilter(list);
|
this.myPartitionList = ItemViewCell.createFilter(list);
|
||||||
@@ -99,7 +111,7 @@ public class FluidRepo implements IDisplayRepo {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateView() {
|
public void updateView() {
|
||||||
this.view.clear();
|
if (needUpdateView()) this.view.clear();
|
||||||
this.dsp.clear();
|
this.dsp.clear();
|
||||||
|
|
||||||
this.view.ensureCapacity(this.list.size());
|
this.view.ensureCapacity(this.list.size());
|
||||||
@@ -130,7 +142,7 @@ public class FluidRepo implements IDisplayRepo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IAEItemStack is : this.list) {
|
for (IAEItemStack is : needUpdateView() ? this.list : this.cache) {
|
||||||
if (this.myPartitionList != null) {
|
if (this.myPartitionList != null) {
|
||||||
if (!this.myPartitionList.isListed(is)) {
|
if (!this.myPartitionList.isListed(is)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -167,26 +179,30 @@ public class FluidRepo implements IDisplayRepo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (needUpdateView()) {
|
||||||
|
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||||
|
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||||
|
|
||||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
FluidSorters.init();
|
||||||
|
|
||||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
if (SortBy == SortOrder.MOD) {
|
||||||
FluidSorters.init();
|
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||||
|
} else if (SortBy == SortOrder.AMOUNT) {
|
||||||
if (SortBy == SortOrder.MOD) {
|
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||||
} else if (SortBy == SortOrder.AMOUNT) {
|
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
} else {
|
||||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
}
|
||||||
} else {
|
} else {
|
||||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
this.cache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final IAEItemStack is : this.view) {
|
for (final IAEItemStack is : this.view) {
|
||||||
this.dsp.add(is.getItemStack());
|
this.dsp.add(is.getItemStack());
|
||||||
}
|
}
|
||||||
|
this.lastSearchString = this.searchString;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateNEI(final String filter) {
|
protected void updateNEI(final String filter) {
|
||||||
|
|||||||
Reference in new issue
Block a user