Added Crafting/Stored/Both setting to ItemRepo

This commit is contained in:
AlgorithmX2 2014-05-22 21:41:09 -05:00
parent 5f5fc4cee1
commit e2c3e18133
4 changed files with 41 additions and 0 deletions

View file

@ -369,6 +369,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
return configSrc.getSetting( Settings.SORT_DIRECTION );
}
@Override
public Enum getSortDisplay()
{
return configSrc.getSetting( Settings.VIEW_MODE );
}
@Override
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
{

View file

@ -13,6 +13,7 @@ import org.lwjgl.opengl.GL11;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.implementations.guiobjects.INetworkTool;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
@ -285,4 +286,10 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
{
return SortDir.ASCENDING;
}
@Override
public Enum getSortDisplay()
{
return ViewItems.ALL;
}
}

View file

@ -1,10 +1,24 @@
package appeng.client.gui.widgets;
import appeng.api.config.SortDir;
import appeng.api.config.ViewItems;
public interface ISortSource
{
/**
* @return Sor
*/
Enum getSortBy();
/**
* @return {@link SortDir}
*/
Enum getSortDir();
/**
* @return {@link ViewItems}
*/
Enum getSortDisplay();
}

View file

@ -14,6 +14,7 @@ import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.Upgrades;
import appeng.api.config.ViewItems;
import appeng.api.config.YesNo;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.storage.data.IAEItemStack;
@ -189,6 +190,7 @@ public class ItemRepo
view.ensureCapacity( list.size() );
dsp.ensureCapacity( list.size() );
Enum vmode = sortSrc.getSortDisplay();
Enum mode = AEConfig.instance.settings.getSetting( Settings.SEARCH_MODE );
if ( mode == SearchBoxMode.NEI_AUTOSEARCH || mode == SearchBoxMode.NEI_MANUAL_SEARCH )
updateNEI( searchString );
@ -222,6 +224,18 @@ public class ItemRepo
continue;
}
if ( vmode == ViewItems.CRAFTABLE && !is.isCraftable() )
continue;
if ( vmode == ViewItems.CRAFTABLE )
{
is = is.copy();
is.setStackSize( 0 );
}
if ( vmode == ViewItems.STORED && is.getStackSize() == 0 )
continue;
String dspName = Platform.getItemDisplayName( is );
notDone = true;