Improve grid search

This commit is contained in:
Raoul Van den Berge
2016-11-12 17:36:07 +01:00
parent 22773df0d9
commit 39d5e8fce5
2 changed files with 3 additions and 22 deletions

View File

@@ -147,7 +147,6 @@ public class GuiReaderWriter extends GuiBase {
} }
} }
@Override @Override
protected void keyTyped(char character, int keyCode) throws IOException { protected void keyTyped(char character, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_DELETE) { if (keyCode == Keyboard.KEY_DELETE) {

View File

@@ -9,7 +9,6 @@ import com.raoulvdberge.refinedstorage.block.EnumGridType;
import com.raoulvdberge.refinedstorage.container.ContainerGrid; import com.raoulvdberge.refinedstorage.container.ContainerGrid;
import com.raoulvdberge.refinedstorage.gui.GuiBase; import com.raoulvdberge.refinedstorage.gui.GuiBase;
import com.raoulvdberge.refinedstorage.gui.Scrollbar; import com.raoulvdberge.refinedstorage.gui.Scrollbar;
import com.raoulvdberge.refinedstorage.gui.grid.filtering.GridFilterMod;
import com.raoulvdberge.refinedstorage.gui.grid.filtering.GridFilterParser; import com.raoulvdberge.refinedstorage.gui.grid.filtering.GridFilterParser;
import com.raoulvdberge.refinedstorage.gui.grid.filtering.IGridFilter; import com.raoulvdberge.refinedstorage.gui.grid.filtering.IGridFilter;
import com.raoulvdberge.refinedstorage.gui.grid.sorting.GridSortingName; import com.raoulvdberge.refinedstorage.gui.grid.sorting.GridSortingName;
@@ -30,7 +29,6 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -120,7 +118,7 @@ public class GuiGrid extends GuiBase {
} }
if (grid.getType() == EnumGridType.PATTERN) { if (grid.getType() == EnumGridType.PATTERN) {
oredictPattern = addCheckBox(x + 64, y + 138, I18n.format("misc.refinedstorage:oredict"), TileGrid.OREDICT_PATTERN.getValue()); oredictPattern = addCheckBox(x + 64, y + 138, t("misc.refinedstorage:oredict"), TileGrid.OREDICT_PATTERN.getValue());
} }
if (grid.getType() != EnumGridType.FLUID) { if (grid.getType() != EnumGridType.FLUID) {
@@ -151,28 +149,12 @@ public class GuiGrid extends GuiBase {
while (t.hasNext()) { while (t.hasNext()) {
IClientStack stack = t.next(); IClientStack stack = t.next();
int accepts = 0;
IGridFilter previous = null;
for (IGridFilter filter : filters) { for (IGridFilter filter : filters) {
if (!filter.accepts(stack)) { if (!filter.accepts(stack)) {
if (filter.isStrong() || previous instanceof GridFilterMod) {
// avoid removing twice
accepts = -1;
t.remove(); t.remove();
break; break;
} }
} else {
accepts++;
}
previous = filter;
}
if (accepts == 0) {
t.remove();
} }
} }