EntityPlayer player = PacketHandler.getPlayer(context);
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(tileEntity instanceof IUpgradeManagement && tileEntity instanceof TileEntityBasicBlock)
{
IUpgradeManagement upgradeTile = (IUpgradeManagement)tileEntity;
if(message.upgradeType == 0)
{
if(upgradeTile.getSpeedMultiplier() > 0)
{
if(player.inventory.addItemStackToInventory(new ItemStack(Mekanism.SpeedUpgrade)))
{
upgradeTile.setSpeedMultiplier(upgradeTile.getSpeedMultiplier()-1);
}
}
}
else if(message.upgradeType == 1)
{
if(upgradeTile.getEnergyMultiplier() > 0)
{
if(player.inventory.addItemStackToInventory(new ItemStack(Mekanism.EnergyUpgrade)))
{
upgradeTile.setEnergyMultiplier(upgradeTile.getEnergyMultiplier()-1);
}
}
}
}