Fixes #675 No disabled feature should log spam or crash anymore.

Deprecates the old usage of the AEItemDefinitions via the direct method access of

* blocks()
* parts()
* items()
* materials()

and thus use the new re-direct via definitions().

All definitions are now initialized, no matter what. But SubItems, Items and Blocks are not registered, if by chance are disabled.
This commit is contained in:
thatsIch
2015-01-03 02:53:14 +01:00
parent 3dd81433ac
commit 9986ffc458
385 changed files with 12477 additions and 8292 deletions
@@ -18,6 +18,7 @@
package appeng.items.storage;
import java.util.EnumSet;
import net.minecraft.inventory.IInventory;
@@ -41,102 +42,61 @@ import appeng.util.prioitylist.IPartitionList;
import appeng.util.prioitylist.MergedPriorityList;
import appeng.util.prioitylist.PrecisePriorityList;
public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
{
public ItemViewCell()
{
super( ItemViewCell.class );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setMaxStackSize( 1 );
}
@Override
public boolean isEditable(ItemStack is)
{
return true;
}
@Override
public IInventory getUpgradesInventory(ItemStack is)
{
return new CellUpgrades( is, 2 );
}
@Override
public IInventory getConfigInventory(ItemStack is)
{
return new CellConfig( is );
}
@Override
public FuzzyMode getFuzzyMode(ItemStack is)
{
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
}
catch (Throwable t)
{
return FuzzyMode.IGNORE_ALL;
}
}
@Override
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
}
public static IPartitionList<IAEItemStack> createFilter(ItemStack[] list)
public static IPartitionList<IAEItemStack> createFilter( ItemStack[] list )
{
IPartitionList<IAEItemStack> myPartitionList = null;
MergedPriorityList<IAEItemStack> myMergedList = new MergedPriorityList<IAEItemStack>();
for (ItemStack currentViewCell : list)
for ( ItemStack currentViewCell : list )
{
if ( currentViewCell == null )
continue;
if ( (currentViewCell.getItem() instanceof ItemViewCell) )
if ( ( currentViewCell.getItem() instanceof ItemViewCell ) )
{
boolean hasInverter = false;
boolean hasFuzzy = false;
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
ItemViewCell vc = (ItemViewCell) currentViewCell.getItem();
ICellWorkbenchItem vc = (ICellWorkbenchItem) currentViewCell.getItem();
IInventory upgrades = vc.getUpgradesInventory( currentViewCell );
IInventory config = vc.getConfigInventory( currentViewCell );
FuzzyMode fzMode = vc.getFuzzyMode( currentViewCell );
hasInverter = false;
hasFuzzy = false;
boolean hasInverter = false;
boolean hasFuzzy = false;
for (int x = 0; x < upgrades.getSizeInventory(); x++)
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 );
Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
if ( u != null )
{
switch (u)
switch ( u )
{
case FUZZY:
hasFuzzy = true;
break;
case INVERTER:
hasInverter = true;
break;
default:
case FUZZY:
hasFuzzy = true;
break;
case INVERTER:
hasInverter = true;
break;
default:
}
}
}
}
for (int x = 0; x < config.getSizeInventory(); x++)
for ( int x = 0; x < config.getSizeInventory(); x++ )
{
ItemStack is = config.getStackInSlot( x );
if ( is != null )
@@ -157,4 +117,42 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
return myPartitionList;
}
@Override
public boolean isEditable( ItemStack is )
{
return true;
}
@Override
public IInventory getUpgradesInventory( ItemStack is )
{
return new CellUpgrades( is, 2 );
}
@Override
public IInventory getConfigInventory( ItemStack is )
{
return new CellConfig( is );
}
@Override
public FuzzyMode getFuzzyMode( ItemStack is )
{
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
}
catch ( Throwable t )
{
return FuzzyMode.IGNORE_ALL;
}
}
@Override
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
}
}