if ( Platform.isWrench( player, is, x, y, z ) && player.isSneaking() )
{
Block id = w.getBlock( x, y, z );
if ( id != null )
{
AEBaseTile tile = getTileEntity( w, x, y, z );
ItemStack[] drops = Platform.getBlockDrops( w, x, y, z );
if ( tile == null )
return false;
if ( tile instanceof TileCableBus || tile instanceof TileSkyChest )
return false;
ItemStack op = new ItemStack( this );
for (ItemStack ol : drops)
{
if ( Platform.isSameItemType( ol, op ) )
{
NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
if ( tag != null )
ol.setTagCompound( tag );
}
}
if ( id.removedByPlayer( w, player, x, y, z, false ) )
{
List<ItemStack> l = Lists.newArrayList(drops);
Platform.spawnDrops( w, x, y, z, l );
w.setBlockToAir( x, y, z );
}
}
return false;
}
if ( is.getItem() instanceof IMemoryCard && !(this instanceof BlockCableBus) )
{
IMemoryCard memoryCard = (IMemoryCard) is.getItem();
if ( player.isSneaking() )
{
AEBaseTile t = getTileEntity( w, x, y, z );
if ( t != null )
{
String name = getUnlocalizedName();
NBTTagCompound data = t.downloadSettings( SettingsFrom.MEMORY_CARD );
if ( data != null )
{
memoryCard.setMemoryCardContents( is, name, data );
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
return true;
}
}
}
else
{
String name = memoryCard.getSettingsName( is );
NBTTagCompound data = memoryCard.getData( is );
if ( getUnlocalizedName().equals( name ) )
{
AEBaseTile t = getTileEntity( w, x, y, z );
t.uploadSettings( SettingsFrom.MEMORY_CARD, data );
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
}
else
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
return false;