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:
@@ -25,15 +25,15 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.definitions.Items;
|
||||
import appeng.api.definitions.Materials;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
|
||||
|
||||
public final class CreativeTab extends CreativeTabs
|
||||
{
|
||||
|
||||
public static CreativeTab instance = null;
|
||||
|
||||
public CreativeTab()
|
||||
@@ -55,25 +55,21 @@ public final class CreativeTab extends CreativeTabs
|
||||
@Override
|
||||
public ItemStack getIconItemStack()
|
||||
{
|
||||
final IAppEngApi api = AEApi.instance();
|
||||
final appeng.api.definitions.Blocks blocks = api.blocks();
|
||||
final Items items = api.items();
|
||||
final Materials materials = api.materials();
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
return this.findFirst( blocks.blockController, blocks.blockChest, blocks.blockCellWorkbench, blocks.blockFluix, items.itemCell1k, items.itemNetworkTool, materials.materialFluixCrystal, materials.materialCertusQuartzCrystal );
|
||||
return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluix(), items.cell1k(), items.networkTool(), materials.fluixCrystal(), materials.certusQuartzCrystal() );
|
||||
}
|
||||
|
||||
private ItemStack findFirst( AEItemDefinition... choices )
|
||||
private ItemStack findFirst( IItemDefinition... choices )
|
||||
{
|
||||
for ( AEItemDefinition a : choices )
|
||||
for ( IItemDefinition definition : choices )
|
||||
{
|
||||
if ( a != null )
|
||||
for ( ItemStack definitionStack : definition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
ItemStack is = a.stack( 1 );
|
||||
if ( is != null )
|
||||
{
|
||||
return is;
|
||||
}
|
||||
return definitionStack;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user