2015-08-06 18:49:57 +02:00
|
|
|
|
2015-01-03 02:53:14 +01:00
|
|
|
package appeng.parts.automation;
|
|
|
|
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemBlock;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
import appeng.api.config.Upgrades;
|
|
|
|
import appeng.tile.inventory.IAEAppEngInventory;
|
|
|
|
|
|
|
|
|
|
|
|
public class BlockUpgradeInventory extends UpgradeInventory
|
|
|
|
{
|
|
|
|
private final Block block;
|
|
|
|
|
2015-09-25 23:10:56 +02:00
|
|
|
public BlockUpgradeInventory( final Block block, final IAEAppEngInventory parent, final int s )
|
2015-01-03 02:53:14 +01:00
|
|
|
{
|
|
|
|
super( parent, s );
|
|
|
|
this.block = block;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-09-25 23:10:56 +02:00
|
|
|
public int getMaxInstalled( final Upgrades upgrades )
|
2015-01-03 02:53:14 +01:00
|
|
|
{
|
|
|
|
int max = 0;
|
|
|
|
|
2015-09-25 23:10:56 +02:00
|
|
|
for( final ItemStack is : upgrades.getSupported().keySet() )
|
2015-01-03 02:53:14 +01:00
|
|
|
{
|
|
|
|
final Item encodedItem = is.getItem();
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
if( encodedItem instanceof ItemBlock && Block.getBlockFromItem( encodedItem ) == this.block )
|
2015-01-03 02:53:14 +01:00
|
|
|
{
|
|
|
|
max = upgrades.getSupported().get( is );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return max;
|
|
|
|
}
|
|
|
|
}
|