Fix grid sorting issues

This commit is contained in:
Raoul Van den Berge
2016-08-09 00:55:17 +02:00
parent 7e1edec388
commit 8c9e5a3dff
6 changed files with 21 additions and 14 deletions

View File

@@ -12,7 +12,7 @@ buildscript {
}
apply plugin: 'net.minecraftforge.gradle.forge'
version = "0.8.16-rc1"
version = "0.8.16"
group = "refinedstorage"
archivesBaseName = "refinedstorage"

View File

@@ -18,7 +18,7 @@ import refinedstorage.proxy.CommonProxy;
@Mod(modid = RefinedStorage.ID, version = RefinedStorage.VERSION, dependencies = RefinedStorage.DEPENDENCIES)
public final class RefinedStorage {
public static final String ID = "refinedstorage";
public static final String VERSION = "0.8.16-rc1";
public static final String VERSION = "0.8.16";
public static final String DEPENDENCIES = "required-after:mcmultipart";
@SidedProxy(clientSide = "refinedstorage.proxy.ClientProxy", serverSide = "refinedstorage.proxy.ServerProxy")

View File

@@ -103,14 +103,14 @@ public class GuiGrid extends GuiBase {
return;
}
SORTED_ITEMS.clear();
List<ClientStack> sortedItems = new ArrayList<>();
if (gui.getGrid().isConnected()) {
SORTED_ITEMS.addAll(ITEMS);
sortedItems.addAll(ITEMS);
String query = gui.searchField.getText().trim().toLowerCase();
Iterator<ClientStack> t = SORTED_ITEMS.iterator();
Iterator<ClientStack> t = sortedItems.iterator();
while (t.hasNext()) {
ClientStack stack = t.next();
@@ -174,13 +174,15 @@ public class GuiGrid extends GuiBase {
SORTING_NAME.setSortingDirection(gui.getGrid().getSortingDirection());
SORTING_QUANTITY.setSortingDirection(gui.getGrid().getSortingDirection());
Collections.sort(SORTED_ITEMS, SORTING_NAME);
Collections.sort(sortedItems, SORTING_NAME);
if (gui.getGrid().getSortingType() == TileGrid.SORTING_TYPE_QUANTITY) {
Collections.sort(SORTED_ITEMS, SORTING_QUANTITY);
Collections.sort(sortedItems, SORTING_QUANTITY);
}
}
SORTED_ITEMS = sortedItems;
gui.getScrollbar().setCanScroll(gui.getRows() > gui.getVisibleRows());
gui.getScrollbar().setScrollDelta((float) gui.getScrollbar().getScrollbarHeight() / (float) gui.getRows());
}

View File

@@ -9,8 +9,6 @@ import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import net.minecraftforge.items.wrapper.InvWrapper;
@@ -53,7 +51,7 @@ public class TileGrid extends TileNode implements IGrid {
tile.markDirty();
}
}
});
}, parameter -> GuiGrid.sortItems());
public static final TileDataParameter<Integer> SORTING_DIRECTION = TileDataManager.createParameter(DataSerializers.VARINT, 0, new ITileDataProducer<Integer, TileGrid>() {
@Override
@@ -69,7 +67,7 @@ public class TileGrid extends TileNode implements IGrid {
tile.markDirty();
}
}
});
}, parameter -> GuiGrid.sortItems());
public static final TileDataParameter<Integer> SORTING_TYPE = TileDataManager.createParameter(DataSerializers.VARINT, 0, new ITileDataProducer<Integer, TileGrid>() {
@Override
@@ -85,7 +83,7 @@ public class TileGrid extends TileNode implements IGrid {
tile.markDirty();
}
}
});
}, parameter -> GuiGrid.sortItems());
public static final TileDataParameter<Integer> SEARCH_BOX_MODE = TileDataManager.createParameter(DataSerializers.VARINT, 0, new ITileDataProducer<Integer, TileGrid>() {
@Override
@@ -102,7 +100,7 @@ public class TileGrid extends TileNode implements IGrid {
}
}
}, parameter -> {
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT && Minecraft.getMinecraft().currentScreen instanceof GuiGrid) {
if (Minecraft.getMinecraft().currentScreen instanceof GuiGrid) {
((GuiGrid) Minecraft.getMinecraft().currentScreen).updateSearchFieldFocus(parameter.getValue());
}
});

View File

@@ -10,6 +10,7 @@ import refinedstorage.RefinedStorage;
import refinedstorage.api.network.IGridHandler;
import refinedstorage.block.EnumGridType;
import refinedstorage.gui.grid.GridFilteredItem;
import refinedstorage.gui.grid.GuiGrid;
import refinedstorage.inventory.ItemHandlerBasic;
import refinedstorage.inventory.ItemHandlerGridFilterInGrid;
import refinedstorage.item.ItemWirelessGrid;
@@ -114,6 +115,8 @@ public class WirelessGrid implements IGrid {
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(type, getSortingDirection(), getSortingType(), getSearchBoxMode()));
this.viewType = type;
GuiGrid.sortItems();
}
@Override
@@ -121,6 +124,8 @@ public class WirelessGrid implements IGrid {
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(getViewType(), getSortingDirection(), type, getSearchBoxMode()));
this.sortingType = type;
GuiGrid.sortItems();
}
@Override
@@ -128,6 +133,8 @@ public class WirelessGrid implements IGrid {
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(getViewType(), direction, getSortingType(), getSearchBoxMode()));
this.sortingDirection = direction;
GuiGrid.sortItems();
}
@Override

View File

@@ -3,7 +3,7 @@
"modid": "refinedstorage",
"name": "Refined Storage",
"description": "A Minecraft mod all about storage.",
"version": "0.8.16-rc1",
"version": "0.8.16",
"mcversion": "1.10.2",
"url": "",
"updateUrl": "",