Added Facade Crafting.
This commit is contained in:
+36
-22
@@ -112,28 +112,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem
|
||||
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
|
||||
for (ItemStack l : tmpList)
|
||||
{
|
||||
if ( l.hasTagCompound() )
|
||||
continue;
|
||||
|
||||
int metadata = l.getItem().getMetadata( l.getItemDamage() );
|
||||
|
||||
boolean hasTile = b.hasTileEntity( metadata );
|
||||
boolean enableGlass = b instanceof BlockGlass;
|
||||
boolean disableOre = b instanceof OreQuartz;
|
||||
|
||||
boolean defaultValue = (b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre) || enableGlass;
|
||||
if ( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
|
||||
{
|
||||
ItemStack is = new ItemStack( this );
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
int[] ds = new int[2];
|
||||
ds[0] = Item.getIdFromItem( l.getItem() );
|
||||
ds[1] = metadata;
|
||||
data.setIntArray( "x", ds );
|
||||
is.setTagCompound( data );
|
||||
|
||||
subTypes.add( is );
|
||||
}
|
||||
ItemStack facade = createFacadeForItem( l, false );
|
||||
if ( l != null )
|
||||
subTypes.add( l );
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
@@ -148,6 +129,39 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem
|
||||
|
||||
}
|
||||
|
||||
public ItemStack createFacadeForItem(ItemStack l, boolean returnItem)
|
||||
{
|
||||
if ( l == null )
|
||||
return null;
|
||||
|
||||
Block b = Block.getBlockFromItem( l.getItem() );
|
||||
if ( b == null || l.hasTagCompound() )
|
||||
return null;
|
||||
|
||||
int metadata = l.getItem().getMetadata( l.getItemDamage() );
|
||||
|
||||
boolean hasTile = b.hasTileEntity( metadata );
|
||||
boolean enableGlass = b instanceof BlockGlass;
|
||||
boolean disableOre = b instanceof OreQuartz;
|
||||
|
||||
boolean defaultValue = (b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre) || enableGlass;
|
||||
if ( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
|
||||
{
|
||||
if ( returnItem )
|
||||
return l;
|
||||
|
||||
ItemStack is = new ItemStack( this );
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
int[] ds = new int[2];
|
||||
ds[0] = Item.getIdFromItem( l.getItem() );
|
||||
ds[1] = metadata;
|
||||
data.setIntArray( "x", ds );
|
||||
is.setTagCompound( data );
|
||||
return is;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(ItemStack is)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user