Added Sky Stone Dust.

Added View Cell.
Configure View Cell in Cell Workbench.
View Cell Can Filter Terminals by being inserted into the Side Slot.
This commit is contained in:
AlgorithmX2
2014-03-04 01:52:07 -06:00
parent 500558982f
commit 4536189042
9 changed files with 209 additions and 5 deletions
+78
View File
@@ -4,18 +4,27 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.regex.Pattern;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.Upgrades;
import appeng.api.config.YesNo;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig;
import appeng.items.storage.ItemViewCell;
import appeng.util.ItemSorters;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import appeng.util.prioitylist.FuzzyPriorityList;
import appeng.util.prioitylist.IPartitionList;
import appeng.util.prioitylist.PrecisePriorityList;
public class ItemRepo
{
@@ -71,6 +80,68 @@ public class ItemRepo
list.add( is );
}
boolean hasInverter = false;
boolean hasFuzzy = false;
IPartitionList<IAEItemStack> myPartitionList;
public void setViewCell(ItemStack currentViewCell)
{
if ( currentViewCell == null || !(currentViewCell.getItem() instanceof ItemViewCell) )
myPartitionList = null;
else
{
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
ItemViewCell vc = (ItemViewCell) currentViewCell.getItem();
IInventory upgrades = vc.getUpgradesInventory( currentViewCell );
IInventory config = vc.getConfigInventory( currentViewCell );
FuzzyMode fzMode = vc.getFuzzyMode( currentViewCell );
hasInverter = false;
hasFuzzy = false;
for (int x = 0; x < upgrades.getSizeInventory(); x++)
{
ItemStack is = upgrades.getStackInSlot( x );
if ( is != null && is.getItem() instanceof IUpgradeModule )
{
Upgrades u = ((IUpgradeModule) is.getItem()).getType( is );
if ( u != null )
{
switch (u)
{
case FUZZY:
hasFuzzy = true;
break;
case INVERTER:
hasInverter = true;
break;
default:
}
}
}
}
for (int x = 0; x < config.getSizeInventory(); x++)
{
ItemStack is = config.getStackInSlot( x );
if ( is != null )
priorityList.add( AEItemStack.create( is ) );
}
// myWhitelist = hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
if ( !priorityList.isEmpty() )
{
if ( hasFuzzy )
myPartitionList = new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode );
else
myPartitionList = new PrecisePriorityList<IAEItemStack>( priorityList );
}
}
updateView();
}
public void updateView()
{
view.clear();
@@ -102,6 +173,12 @@ public class ItemRepo
boolean notDone = false;
for (IAEItemStack is : list)
{
if ( myPartitionList != null )
{
if ( hasInverter == myPartitionList.isListed( is ) )
continue;
}
String dspName = Platform.getItemDisplayName( is );
notDone = true;
@@ -154,4 +231,5 @@ public class ItemRepo
{
list.resetStatus();
}
}